X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fmusical-request.cc;h=ae24d23a2e44772ac0b017943eefc887d922205e;hb=6eb2e2f71f9895b58a01693a94ea84a432bb3766;hp=c4d8efa4fe212fec3e167c23fbdfac04528f1a43;hpb=eabde958a9a4559f474d2736e298bfda9920c4e0;p=lilypond.git diff --git a/lily/musical-request.cc b/lily/musical-request.cc index c4d8efa4fe..ae24d23a2e 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1999 Han-Wen Nienhuys + (c) 1997--2001 Han-Wen Nienhuys */ #include "musical-request.hh" @@ -11,191 +11,104 @@ #include "debug.hh" #include "music-list.hh" -void -Span_req::do_print () const -{ -#ifndef NPRINT - DOUT << span_dir_; -#endif -} Tremolo_req::Tremolo_req () { - type_i_ = 0; -} - -void -Tremolo_req::do_print () const -{ -#ifndef NPRINT - DOUT << "type " << type_i_ << '\n'; -#endif } void -Melodic_req::transpose (Musical_pitch delta) +Melodic_req::transpose (Pitch delta) { - pitch_.transpose (delta); + Pitch p = *unsmob_pitch (get_mus_property ("pitch")); + + p.transpose (delta); - if (abs (pitch_.accidental_i_) > 2) + if (abs (p.alteration_i_) > 2) { - warning (_f ("transposition by %s makes accidental larger than two", + warning (_f ("Transposition by %s makes accidental larger than two", delta.str ())); } -} - - - -bool -Melodic_req::do_equal_b (Request*r) const -{ - Melodic_req* m= dynamic_cast (r); - return m&& !compare (*m, *this); -} -int -Melodic_req::compare (Melodic_req const &m1 , Melodic_req const&m2) -{ - return Musical_pitch::compare (m1.pitch_, m2.pitch_); + set_mus_property ("pitch", p.smobbed_copy ()); } -void -Melodic_req::do_print () const -{ - pitch_.print (); -} - - - - -int -Rhythmic_req::compare (Rhythmic_req const &r1, Rhythmic_req const &r2) +bool +Melodic_req::do_equal_b (Request const* r) const { - return (r1.length_mom () - r2.length_mom ()); + Melodic_req const* m= dynamic_cast (r); + return m; // && !compare (*m, *this); } bool -Rhythmic_req::do_equal_b (Request*r) const +Rhythmic_req::do_equal_b (Request const* r) const { - Rhythmic_req* rh = dynamic_cast (r); + Rhythmic_req const* rh = dynamic_cast (r); - return rh && !compare (*this, *rh); + return rh; // ; && !compare (*this, *rh); } -void -Rhythmic_req::do_print () const -{ -#ifndef NPRINT - DOUT << "duration { " <length_mom (); + } void Rhythmic_req::compress (Moment m) { - duration_.compress (m); -} + Duration *d = unsmob_duration (get_mus_property ("duration")); -void -Lyric_req::do_print () const -{ -#ifndef NPRINT - Rhythmic_req::do_print (); - DOUT << "text = " << text_str_; -#endif + set_mus_property ("duration", d ->compressed (m.main_part_).smobbed_copy ()); } - bool -Note_req::do_equal_b (Request*r) const +Note_req::do_equal_b (Request const* r) const { - Note_req *n = dynamic_cast (r); + Note_req const* n = dynamic_cast (r); return n&& Rhythmic_req::do_equal_b (n) && Melodic_req::do_equal_b (n); } Note_req::Note_req () { - cautionary_b_ = false; - forceacc_b_ = false; -} - - - -void -Note_req::do_print () const -{ -#ifndef NPRINT - Melodic_req::do_print (); - if (cautionary_b_) - { - DOUT << " force cautionary accidental\n"; - } - else if (forceacc_b_) - { - DOUT << " force accidental\n"; - } - Rhythmic_req::do_print (); -#endif } bool -Span_req::do_equal_b (Request*r) const +Span_req::do_equal_b (Request const*r) const { - Span_req * s = dynamic_cast (r); - return s && span_dir_ == s->span_dir_; + Span_req const* s = dynamic_cast (r); + return s && get_span_dir () == s->get_span_dir (); } Span_req::Span_req () { - span_dir_ = CENTER; } -Abbreviation_beam_req::Abbreviation_beam_req () -{ - type_i_ = 0; -} - -void -Abbreviation_beam_req::do_print () const -{ -#ifndef NPRINT - DOUT << type_i_; -#endif -} - -void -Text_script_req::do_print () const -{ - DOUT << "text" << text_str_ - << ", style = " << style_str_; -} bool -Text_script_req::do_equal_b (Request *r) const +Text_script_req::do_equal_b (Request const* r) const { - Text_script_req * t = dynamic_cast(r); - return t && t->text_str_ == text_str_ && t->style_str_ == style_str_; -} - -void -Articulation_req::do_print () const -{ - DOUT << articulation_str_; + Text_script_req const* t = dynamic_cast (r); + return t && gh_equal_p (get_mus_property ("text"), + t->get_mus_property ("text")); } bool -Articulation_req::do_equal_b (Request*r) const +Articulation_req::do_equal_b (Request const* r) const { - Articulation_req * a = dynamic_cast(r); + Articulation_req const* a = dynamic_cast (r); - return a && articulation_str_ == a->articulation_str_; + return a && gh_equal_p (get_mus_property ("articulation-type"), + r->get_mus_property ("articulation-type")) + && get_direction () == a->get_direction (); } + + + + + +