X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fcommand-request.cc;h=061063eaccea5068eab568a6982bd18289212a9a;hb=b9b40f154d0dfa9c3fcd44028bd8b745b87e4873;hp=e682c8a4f603d8e3e7d3a6314dee26cd2b7c9a45;hpb=29d1ad412ee48aa7a3a1666c7ab7af8fd2e2b1bf;p=lilypond.git diff --git a/lily/command-request.cc b/lily/command-request.cc index e682c8a4f6..061063eacc 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -3,178 +3,117 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1999 Han-Wen Nienhuys + (c) 1997--2002 Han-Wen Nienhuys */ #include "command-request.hh" #include "debug.hh" #include "musical-request.hh" -void -Cadenza_req::do_print () const -{ -#ifndef NPRINT - DOUT << (int)on_b_; -#endif -} - -bool -Cadenza_req::do_equal_b (Request const *r) const -{ - Cadenza_req const*cad = dynamic_cast (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 +Tempo_req::Tempo_req () { - Bar_req const* b = dynamic_cast (r); - return b && type_str_ == b->type_str_; + set_mus_property ("duration", Duration (2,0).smobbed_copy ()); } void -Bar_req::do_print () const +Key_change_req::transpose (Pitch p) { -#ifndef NPRINT - DOUT << type_str_; -#endif -} + SCM newlist = SCM_EOL; + SCM pa = get_mus_property ("pitch-alist"); + for (SCM s = pa; gh_pair_p (s); s = ly_cdr (s)) + { + SCM key = ly_caar (s); + SCM alter = ly_cdar (s); + if (gh_pair_p (key)) + { + Pitch orig (gh_scm2int (ly_car (key)), + gh_scm2int (ly_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); + } + } -Bar_req::Bar_req (String s) -{ - type_str_ = s; + set_mus_property ("pitch-alist", gh_reverse (newlist)); } -Partial_measure_req::Partial_measure_req (Moment m) -{ - length_mom_ =m; -} bool -Partial_measure_req::do_equal_b (Request const* r) const +alist_equal_p (SCM a, SCM b) { - Partial_measure_req const*p = dynamic_cast (r); - - return p&& p->length_mom_ == length_mom_; -} - -bool -Barcheck_req::do_equal_b (Request const *r) const -{ - Barcheck_req const*b = dynamic_cast (r); - return b; -} - -void -Clef_change_req::do_print () const -{ -#ifndef NPRINT - DOUT << clef_str_ ; -#endif -} - -Clef_change_req::Clef_change_req (String s) -{ - clef_str_ = s; -} + for (SCM s = a; + gh_pair_p (s); s = ly_cdr (s)) + { + SCM key = ly_caar (s); + SCM val = ly_cdar (s); + SCM l = scm_assoc (key, b); -void -Partial_measure_req::do_print () const -{ - DOUT << length_mom_; -} + if (l == SCM_BOOL_F + || !gh_equal_p ( ly_cdr (l), val)) -void -Time_signature_change_req::do_print () const -{ -#ifndef NPRINT - DOUT << beats_i_ << "/" << one_beat_i_; -#endif + return false; + } + return true; } bool -Time_signature_change_req::do_equal_b (Request const *r) const +Key_change_req::do_equal_b (Request const * m )const { - Time_signature_change_req const* m - = dynamic_cast (r); + Key_change_req const * kc =dynamic_cast (m); - return m && m->beats_i_ == beats_i_ - && one_beat_i_ == m->one_beat_i_; + if(!kc) + return false; + return alist_equal_p (get_mus_property ("pitch-alist"), + kc->get_mus_property ("pitch-alist")); } -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 -{ - DOUT << dur_.str () << " = " << metronome_i_; -} bool -Tempo_req::do_equal_b (Request const *r) const -{ - Tempo_req const *t = dynamic_cast (r); - - return t&& t->dur_.length_mom ()== dur_.length_mom () && metronome_i_ == t->metronome_i_; -} - - - - -void -Key_change_req::do_print () const -{ -#ifndef NPRINT - for (int i=0; i < key_.pitch_arr_.size (); i++) - { - key_.pitch_arr_[i].print (); - } -#endif -} - -Key_change_req::Key_change_req () -{ -} - -Break_req::Break_req () -{ - penalty_i_ = 0; -} - -Mark_req::Mark_req (String s) -{ - str_ = s; -} - -void -Mark_req::do_print () const -{ - DOUT << str_; -} -void -Key_change_req::transpose (Musical_pitch p) -{ - key_.transpose (p); -} - - - +Mark_req::do_equal_b (Request const * r) const +{ + Mark_req const * other = dynamic_cast (r); + return other && scm_equal_p (other->get_mus_property ("label"), + get_mus_property ("label")) == SCM_BOOL_T; +} + +ADD_MUSIC(Bass_figure_req); +ADD_MUSIC (Articulation_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 (Porrectus_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);