]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/command-request.cc
patch::: 1.3.141.jcn3
[lilypond.git] / lily / command-request.cc
index 92e7097c4351d2433a3f9526496751a8ef9d20d1..ea7e0a4a20cdad1578ae20cf289c636707285ec8 100644 (file)
 /*
-  commandrequest.cc -- implement Nonmusical reqs
+  command-request.cc -- implement non-musical reqs
 
-  source file of the LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "command-request.hh"
 #include "debug.hh"
 #include "musical-request.hh"
 
-
-void
-Cadenza_req::do_print()const
-{
-    mtor << on_b_;
-}
-
-Cadenza_req::Cadenza_req(bool b)
-{
-    on_b_ =b;
-}
-/* *************** */
-
-
-int
-Bar_req::compare(Bar_req const &c1)const
-{
-    return type_str_ == c1.type_str_;
-}
-
-void
-Bar_req::do_print() const
-{
-    mtor << type_str_;
-}
-
-Bar_req::Bar_req(String s)
-{
-    type_str_ = s;
-}
-
-Partial_measure_req::Partial_measure_req(Moment m)
+bool
+Barcheck_req::do_equal_b (Request const *r) const
 {
-    duration_ =m;
+  Barcheck_req  const*b = dynamic_cast<Barcheck_req const*> (r);
+  return b;
 }
-/* *************** */
-Meter_change_req::Meter_change_req()
-{
-    beats_i_ = 0;
-    one_beat_i_ =0;
-}
-void
-Meter_change_req::set(int b,int o)
-{
-    beats_i_=b;
-    one_beat_i_=o;
-}
-
-void
-Timing_req::do_print()const{}
 
-void
-Command_req::do_print()const{}
-/* *************** */
-void
-Barcheck_req::do_print() const{}
-
-/* *************** */
-void
-Clef_change_req::do_print() const
+Tempo_req::Tempo_req ()
 {
-    mtor << clef_str_ ;
+  set_mus_property ("duration", Duration (2,0).smobbed_copy ());
 }
 
-Clef_change_req::Clef_change_req(String s)
-{
-    clef_str_ = s;
-}
-/* *************** */
 void
-Group_feature_req::do_print() const
-{
-    mtor << "stemdir " << stemdir_i_;
-}
+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);
+       }
+    }
 
-Group_feature_req::Group_feature_req()
-{
-    stemdir_i_ = 0;
+  set_mus_property ("pitch-alist", newlist);
 }
 
-void
-Group_change_req::do_print()const
-{
-    mtor << "id : " << newgroup_str_;
-}
-/* *************** */
-void
-Terminate_voice_req::do_print()const
+Break_req::Break_req ()
 {
 }
 
-/* *************** */
-void
-Partial_measure_req::do_print() const
-{
-    mtor << duration_;
-}
 
-void
-Meter_change_req::do_print() const
+bool
+Mark_req::do_equal_b (Request const * r) const
 {
-    mtor << beats_i_ << "*" << one_beat_i_;
+  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")) == SCM_BOOL_T;
 }
 
-/* *************** */
-
-void
-Measure_grouping_req::do_print() const
-{
-    for (int i=0; i < elt_length_arr_.size(); i++) {
-       mtor << beat_i_arr_[i] <<"*" << elt_length_arr_[i]<<" ";
-    }
-}
-/* *************** */
 
-void
-Key_change_req::transpose(Melodic_req const & d)const
-{
-    WARN << "don't know how to transpose a key. \n";
-    for (int i=0; i < melodic_p_arr_.size(); i++) {
-       melodic_p_arr_[i]->transpose(d);
-    }
-}
-
-void
-Key_change_req::do_print() const
-{
-    for (int i=0; i < melodic_p_arr_.size(); i++) {
-       melodic_p_arr_[i]->print();
-    }
-}
-
-Key_change_req::Key_change_req()
-{
-}
-Key_change_req::Key_change_req(Key_change_req const&c)
-{
-    for (int i=0; i < c.melodic_p_arr_.size(); i++) {
-       melodic_p_arr_.push( c.melodic_p_arr_[i]->clone()->melodic() );
-    }
-}
-
-Key_change_req::~Key_change_req()
-{
-    for (int i=0; i < melodic_p_arr_.size(); i++)
-       delete melodic_p_arr_[i];
-}
+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);