From: Han-Wen Nienhuys Date: Thu, 26 Sep 2002 23:29:35 +0000 (+0000) Subject: * input/trip.ly (fugaIILeft): add arpeggio X-Git-Tag: release/1.7.1~13 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=ca0b17c8114a61e317c2cd7d4fe4e2661337aebf;p=lilypond.git * input/trip.ly (fugaIILeft): add arpeggio * lily/translator-group.cc (try_music_on_nongroup_children): oops. The name symbol is in the cdr of the assoc handle. * lily/: remove Arpeggio_req, Breathing_sign_req, Extender_req, Hyphen_req, Glissando_req, Break_req, Mark_req --- diff --git a/ChangeLog b/ChangeLog index 87f7f31661..8c0f51f2f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-09-27 Han-Wen Nienhuys + + * input/trip.ly (fugaIILeft): add arpeggio + + * lily/translator-group.cc (try_music_on_nongroup_children): + oops. The name symbol is in the cdr of the assoc handle. + + * lily/: remove Arpeggio_req, Breathing_sign_req, Extender_req, + Hyphen_req, Glissando_req, Break_req, Mark_req + 2002-09-26 Han-Wen Nienhuys * lily/musical-request.cc (music-duration-length, diff --git a/input/trip.ly b/input/trip.ly index 5d9d2047ed..5f8a429b80 100644 --- a/input/trip.ly +++ b/input/trip.ly @@ -145,7 +145,7 @@ fugaIILeft = \notes { \context Staff < { \gracetest - \relative b, < )b2 dis fis a b cis dis> \stemUp ais4 | + \relative b, < )b2 dis-\arpeggio fis a b cis dis> \stemUp ais4 | b2 b4 } \\ { s2 e4 | fis2 fis4 } > diff --git a/lily/arpeggio-engraver.cc b/lily/arpeggio-engraver.cc index 19fc31342b..93767fc0dd 100644 --- a/lily/arpeggio-engraver.cc +++ b/lily/arpeggio-engraver.cc @@ -29,7 +29,7 @@ protected: private: Item* arpeggio_; - Arpeggio_req *arpeggio_req_; + Music *arpeggio_req_; }; Arpeggio_engraver::Arpeggio_engraver () @@ -43,13 +43,9 @@ Arpeggio_engraver::try_music (Music* m) { if (!arpeggio_req_) { - if (Arpeggio_req *a = dynamic_cast (m)) - { - arpeggio_req_ = a; - return true; - } + arpeggio_req_ = m; } - return false; + return true; } void @@ -107,7 +103,7 @@ Arpeggio_engraver::stop_translation_timestep () ENTER_DESCRIPTION(Arpeggio_engraver, /* descr */ "Generate an Arpeggio from a Arpeggio_req", /* creats*/ "Arpeggio", -/* accepts */ "general-music", -/* acks */ "stem-interface rhythmic-head-interface note-column-interface", +/* accepts */ "arpeggio-event", +/* acks */ "stem-interface rhythmic-head-interface note-column-interface", /* reads */ "", /* write */ ""); diff --git a/lily/beam-engraver.cc b/lily/beam-engraver.cc index 3d6b29bb7b..8a9fd77774 100644 --- a/lily/beam-engraver.cc +++ b/lily/beam-engraver.cc @@ -22,11 +22,11 @@ class Beam_engraver : public Engraver { protected: - Drul_array reqs_drul_; + Drul_array reqs_drul_; Spanner *finished_beam_; Spanner *beam_; - Span_req * prev_start_req_; + Music * prev_start_req_; Beaming_info_list * beam_info_; Beaming_info_list * finished_beam_info_; @@ -96,42 +96,36 @@ Beam_engraver::Beam_engraver () bool Beam_engraver::try_music (Music *m) { - if (Span_req * c = dynamic_cast (m)) + if (m->is_mus_type ("abort-event")) { - if (scm_equal_p (c->get_mus_property ("span-type"), - scm_makfrom0str ("abort")) == SCM_BOOL_T) - { - reqs_drul_[START] = 0; - reqs_drul_[STOP] = 0; - if (beam_) - beam_->suicide (); - beam_ = 0; - } - else if (scm_equal_p (c->get_mus_property ("span-type"), - scm_makfrom0str ("beam")) == SCM_BOOL_T) - { - Direction d =c->get_span_dir (); - + reqs_drul_[START] = 0; + reqs_drul_[STOP] = 0; + if (beam_) + beam_->suicide (); + beam_ = 0; + } + else if (m->is_mus_type ("beam-event")) + { + Direction d = to_dir (m->get_mus_property ("span-direction")); - if (d == STOP && !valid_end_moment()) - return false; + if (d == STOP && !valid_end_moment()) + return false; - if (d == START && !valid_start_moment ()) - return false; + if (d == START && !valid_start_moment ()) + return false; - if (d == STOP) + if (d == STOP) + { + SCM m = get_property ("automaticMelismata"); + SCM b = get_property ("autoBeaming"); + if (to_boolean (m) && !to_boolean (b)) { - SCM m = get_property ("automaticMelismata"); - SCM b = get_property ("autoBeaming"); - if (to_boolean (m) && !to_boolean (b)) - { - set_melisma (false); - } + set_melisma (false); } - - reqs_drul_[d ] = c; - return true; } + + reqs_drul_[d ] = m; + return true; } return false; } @@ -261,8 +255,8 @@ Beam_engraver::acknowledge_grob (Grob_info info) if (Stem::get_beam (stem)) return; - Rhythmic_req *rhythmic_req = dynamic_cast (info.music_cause ()); - if (!rhythmic_req) + Music* m = info.music_cause(); + if (!m->is_mus_type ("rhythmic-event")) { String s = _ ("stem must have Rhythmic structure"); if (info.music_cause ()) @@ -275,10 +269,10 @@ Beam_engraver::acknowledge_grob (Grob_info info) last_stem_added_at_ = now; - int durlog = unsmob_duration (rhythmic_req->get_mus_property ("duration"))-> duration_log (); + int durlog = unsmob_duration (m->get_mus_property ("duration"))-> duration_log (); if (durlog <= 2) { - rhythmic_req->origin ()->warning (_ ("stem doesn't fit in beam")); + m->origin ()->warning (_ ("stem doesn't fit in beam")); prev_start_req_->origin ()->warning (_ ("beam was started here")); /* don't return, since diff --git a/lily/breathing-sign-engraver.cc b/lily/breathing-sign-engraver.cc index fe0d3b531d..4ea98cf970 100644 --- a/lily/breathing-sign-engraver.cc +++ b/lily/breathing-sign-engraver.cc @@ -33,7 +33,7 @@ protected: virtual void start_translation_timestep (); private: - Breathing_sign_req * breathing_sign_req_; + Music * breathing_sign_req_; Grob * breathing_sign_; }; @@ -46,13 +46,8 @@ Breathing_sign_engraver::Breathing_sign_engraver () bool Breathing_sign_engraver::try_music (Music*r) { - if (Breathing_sign_req * b= dynamic_cast (r)) - { - breathing_sign_req_ = b; - return true; - } - - return false; + breathing_sign_req_ = r; + return true; } void @@ -88,7 +83,7 @@ Breathing_sign_engraver::start_translation_timestep () ENTER_DESCRIPTION(Breathing_sign_engraver, /* descr */ "", /* creats*/ "BreathingSign", -/* accepts */ "general-music", +/* accepts */ "breathing-event", /* acks */ "", /* reads */ "", /* write */ ""); diff --git a/lily/chord-tremolo-engraver.cc b/lily/chord-tremolo-engraver.cc index 05981c4c33..046deec83d 100644 --- a/lily/chord-tremolo-engraver.cc +++ b/lily/chord-tremolo-engraver.cc @@ -166,7 +166,7 @@ Chord_tremolo_engraver::acknowledge_grob (Grob_info info) } s->set_grob_property ("direction", d); - if (dynamic_cast (info.music_cause ())) + if (info.music_cause ()->is_mus_type ("rhythmic-event")) { Beam::add_stem (beam_, s); } diff --git a/lily/command-request.cc b/lily/command-request.cc index 5892d04022..5d15bc66dc 100644 --- a/lily/command-request.cc +++ b/lily/command-request.cc @@ -10,10 +10,6 @@ #include "musical-request.hh" -Tempo_req::Tempo_req () -{ - set_mus_property ("duration", Duration (2,0).smobbed_copy ()); -} LY_DEFINE(transpose_key_alist,"transpose-key-alist", @@ -94,31 +90,12 @@ Key_change_req::do_equal_b (Request const * m )const -bool -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 (Arpeggio_req); ADD_MUSIC (Articulation_req); -ADD_MUSIC (Break_req); -ADD_MUSIC (Breathing_sign_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 (Porrectus_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 (Tremolo_req); diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index c6252d5a46..301628e2c6 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -45,8 +45,8 @@ class Dynamic_engraver : public Engraver Text_script_req* script_req_; - Span_req * current_cresc_req_; - Drul_array accepted_spanreqs_drul_; + Music * current_cresc_req_; + Drul_array accepted_spanreqs_drul_; Spanner* line_spanner_; Spanner* finished_line_spanner_; @@ -101,30 +101,27 @@ Dynamic_engraver::try_music (Music * m) script_req_ = dynamic_cast (m); return true; } - else if (Span_req* s = dynamic_cast (m)) + else if (m->is_mus_type ("abort-event")) { - String t = ly_scm2string (s->get_mus_property ("span-type")); - if (t== "abort") - { - accepted_spanreqs_drul_[LEFT] = 0; - accepted_spanreqs_drul_[RIGHT] = 0; - /* - Let's not kill the line spanner, since that would fuck up - earlier, not-to-be-terminated stuff. + accepted_spanreqs_drul_[LEFT] = 0; + accepted_spanreqs_drul_[RIGHT] = 0; + /* + Let's not kill the line spanner, since that would fuck up + earlier, not-to-be-terminated stuff. - It will disappear by itself when stop_translation_timestep - () finds that there is nothing to support anymore. */ + It will disappear by itself when stop_translation_timestep + () finds that there is nothing to support anymore. */ - if (cresc_) - cresc_->suicide (); - cresc_ = 0; - } - else if (t == "crescendo" - || t == "decrescendo") - { - accepted_spanreqs_drul_[s->get_span_dir ()] = s; - return true; - } + if (cresc_) + cresc_->suicide (); + cresc_ = 0; + } + else if (m->is_mus_type ("decrescendo-event") + || m->is_mus_type ("crescendo-event")) + { + Direction d = to_dir (m->get_mus_property ("span-direction")); + accepted_spanreqs_drul_[d] = m; + return true; } return false; } @@ -207,7 +204,8 @@ Dynamic_engraver::process_music () { if (current_cresc_req_) { - String msg = current_cresc_req_->get_span_dir () == 1 + Direction sd = to_dir (current_cresc_req_->get_mus_property ("span-direction")); + String msg = sd == 1 ? _ ("already have a crescendo") : _ ("already have a decrescendo"); @@ -222,11 +220,17 @@ Dynamic_engraver::process_music () TODO: Use symbols. */ - String start_type = ly_scm2string (accepted_spanreqs_drul_[START]->get_mus_property ("span-type")); + String start_type = + ly_symbol2string (current_cresc_req_->get_mus_property ("name")); /* ugh. Use push/pop? */ + if (start_type == "DecrescendoEvent") + start_type = "decrescendo"; + else if (start_type == "CrescendoEvent") + start_type = "crescendo"; + SCM s = get_property ((start_type + "Spanner").to_str0 ()); if (!gh_symbol_p (s) || s == ly_symbol2scm ("hairpin")) { @@ -433,7 +437,7 @@ which takes care of vertical positioning. ", /* creats*/ "DynamicLineSpanner DynamicText Hairpin TextSpanner", -/* accepts */ "general-music", +/* accepts */ "text-script-event crescendo-event decrescendo-event", /* acks */ "note-column-interface script-interface", /* reads */ "", /* write */ ""); diff --git a/lily/extender-engraver.cc b/lily/extender-engraver.cc index b6ff094700..e11ec694a6 100644 --- a/lily/extender-engraver.cc +++ b/lily/extender-engraver.cc @@ -30,7 +30,7 @@ class Extender_engraver : public Engraver { Grob *last_lyric_; Grob *current_lyric_; - Extender_req* req_; + Music* req_; Spanner* extender_; public: TRANSLATOR_DECLARATIONS(Extender_engraver); @@ -77,15 +77,11 @@ Extender_engraver::acknowledge_grob (Grob_info i) bool Extender_engraver::try_music (Music* r) { - if (Extender_req* p = dynamic_cast (r)) - { - if (req_) - return false; + if (req_) + return false; - req_ = p; + req_ = r; return true; - } - return false; } void @@ -144,7 +140,7 @@ Extender_engraver::start_translation_timestep () ENTER_DESCRIPTION(Extender_engraver, /* descr */ "Create lyric extenders", /* creats*/ "LyricExtender", -/* accepts */ "general-music", +/* accepts */ "extender-event", /* acks */ "lyric-syllable-interface", /* reads */ "", /* write */ ""); diff --git a/lily/hyphen-engraver.cc b/lily/hyphen-engraver.cc index c15e3bee95..c557055288 100644 --- a/lily/hyphen-engraver.cc +++ b/lily/hyphen-engraver.cc @@ -24,7 +24,7 @@ class Hyphen_engraver : public Engraver { Grob *last_lyric_; Grob *current_lyric_; - Hyphen_req* req_; + Music* req_; Spanner* hyphen_; public: TRANSLATOR_DECLARATIONS(Hyphen_engraver); @@ -70,15 +70,11 @@ Hyphen_engraver::acknowledge_grob (Grob_info i) bool Hyphen_engraver::try_music (Music* r) { - if (Hyphen_req* p = dynamic_cast (r)) - { - if (req_) + if (req_) return false; - req_ = p; + req_ = r; return true; - } - return false; } void @@ -136,7 +132,7 @@ Hyphen_engraver::start_translation_timestep () ENTER_DESCRIPTION(Hyphen_engraver, /* descr */ "Create lyric hyphens", /* creats*/ "LyricHyphen", -/* accepts */ "general-music", +/* accepts */ "hyphen-event", /* acks */ "lyric-syllable-interface", /* reads */ "", /* write */ ""); diff --git a/lily/include/command-request.hh b/lily/include/command-request.hh index db1f5500f5..7345900a7a 100644 --- a/lily/include/command-request.hh +++ b/lily/include/command-request.hh @@ -22,28 +22,6 @@ protected: VIRTUAL_COPY_CONS (Music); }; -class Mark_req : public Request { -public: - virtual bool do_equal_b (Request const*) const; - SCM mark_label (); - VIRTUAL_COPY_CONS (Music); -}; - -/* - int metronome_; - */ -class Tempo_req : public Request -{ -public: - Tempo_req (); -protected: - VIRTUAL_COPY_CONS (Music); -}; - -class Breathing_sign_req : public Request { - VIRTUAL_COPY_CONS (Music); -}; - class Porrectus_req : public Request { VIRTUAL_COPY_CONS (Music); }; diff --git a/lily/include/ligature-engraver.hh b/lily/include/ligature-engraver.hh index 5e8efb7eeb..bc5577a022 100644 --- a/lily/include/ligature-engraver.hh +++ b/lily/include/ligature-engraver.hh @@ -32,9 +32,9 @@ public: TRANSLATOR_DECLARATIONS(Ligature_engraver); private: - Drul_array reqs_drul_; + Drul_array reqs_drul_; - Span_req *prev_start_req_; + Music *prev_start_req_; // moment where ligature started. Moment ligature_start_mom_; diff --git a/lily/include/musical-request.hh b/lily/include/musical-request.hh index 488f080de5..a90c9dcf68 100644 --- a/lily/include/musical-request.hh +++ b/lily/include/musical-request.hh @@ -27,10 +27,6 @@ public: VIRTUAL_COPY_CONS (Music); }; -class Skip_req : public Rhythmic_req { -public: - VIRTUAL_COPY_CONS (Music); -}; struct Tremolo_req : public Request { @@ -72,13 +68,6 @@ protected: virtual bool do_equal_b (Request const*) const; }; -class String_number_req : public Script_req -{ -protected: - VIRTUAL_COPY_CONS (Music); - virtual bool do_equal_b (Request const*) const; -}; - /// request which has some kind of pitch struct Melodic_req :virtual Request { @@ -90,58 +79,6 @@ protected: VIRTUAL_COPY_CONS (Music); }; -/** -Put a rest on the staff. Why a request? It might be a good idea to not typeset the rest, if the paper is too crowded. -*/ -class Rest_req : public Rhythmic_req { -public: - VIRTUAL_COPY_CONS (Music); -}; - - -/// an extender line -class Extender_req : public Request { -public: - VIRTUAL_COPY_CONS (Music); -}; - -/// a centred hyphen -class Hyphen_req : public Request { -public: - VIRTUAL_COPY_CONS (Music); -}; - - - -/** - instruct lyric context to alter typesetting. */ -class Melisma_req : public Span_req -{ -public: - VIRTUAL_COPY_CONS (Music); -}; - - -/** - Helping req to signal start of a melisma from within a context, and - to */ -class Melisma_playing_req : public Request -{ -public: - VIRTUAL_COPY_CONS (Music); -}; - -class Arpeggio_req : public Request -{ -public: - VIRTUAL_COPY_CONS (Music); -}; - -class Glissando_req : public Request -{ -public: - VIRTUAL_COPY_CONS (Music); -}; #endif // MUSICALREQUESTS_HH diff --git a/lily/key-engraver.cc b/lily/key-engraver.cc index cff86db881..ba13f999f7 100644 --- a/lily/key-engraver.cc +++ b/lily/key-engraver.cc @@ -198,7 +198,7 @@ Key_engraver::initialize () ENTER_DESCRIPTION(Key_engraver, /* descr */ "", /* creats*/ "KeySignature", -/* accepts */ "general-music", +/* accepts */ "key-change-event", /* acks */ "bar-line-interface clef-interface", /* reads */ "keySignature lastKeySignature explicitKeySignatureVisibility createKeyOnClefChange keyAccidentalOrder keySignature", /* write */ "lastKeySignature"); diff --git a/lily/ligature-engraver.cc b/lily/ligature-engraver.cc index 29af32f4db..de013610a6 100644 --- a/lily/ligature-engraver.cc +++ b/lily/ligature-engraver.cc @@ -44,24 +44,19 @@ Ligature_engraver::Ligature_engraver () bool Ligature_engraver::try_music (Music *m) { - if (Span_req *req_ = dynamic_cast (m)) + if (m->is_mus_type ("abort-event")) { - if (scm_equal_p (req_->get_mus_property ("span-type"), - scm_makfrom0str ("abort")) == SCM_BOOL_T) - { - reqs_drul_[START] = 0; - reqs_drul_[STOP] = 0; - if (ligature_) - ligature_->suicide (); - ligature_ = 0; - } - else if (scm_equal_p (req_->get_mus_property ("span-type"), - scm_makfrom0str ("ligature")) == SCM_BOOL_T) - { - Direction d = req_->get_span_dir (); - reqs_drul_[d] = req_; - return true; - } + reqs_drul_[START] = 0; + reqs_drul_[STOP] = 0; + if (ligature_) + ligature_->suicide (); + ligature_ = 0; + } + else if (m->is_mus_type ("ligature-event")) + { + Direction d = to_dir (m->get_mus_property ("span-direction")); + reqs_drul_[d] = m; + return true; } return false; } @@ -191,7 +186,7 @@ Ligature_engraver::acknowledge_grob (Grob_info info) ENTER_DESCRIPTION (Ligature_engraver, /* descr */ "Abstract class; a concrete subclass handles Ligature_requests by engraving Ligatures in a concrete style.", /* creats*/ "Ligature", -/* accepts */ "general-music", +/* accepts */ "ligature-event abort-event", /* acks */ "ligature-head-interface rest-interface", /* reads */ "", /* write */ ""); diff --git a/lily/mark-engraver.cc b/lily/mark-engraver.cc index 2a5e2db53d..335fea8bda 100644 --- a/lily/mark-engraver.cc +++ b/lily/mark-engraver.cc @@ -34,13 +34,13 @@ protected: protected: virtual void stop_translation_timestep (); virtual void acknowledge_grob (Grob_info); - void create_items (Request*); + void create_items (Music*); virtual bool try_music (Music *req); virtual void start_translation_timestep (); virtual void process_music (); private: - Mark_req * mark_req_; + Music * mark_req_; }; @@ -80,7 +80,7 @@ Mark_engraver::stop_translation_timestep () void -Mark_engraver::create_items (Request *rq) +Mark_engraver::create_items (Music *rq) { if (text_) return; @@ -103,16 +103,8 @@ Mark_engraver::start_translation_timestep () bool Mark_engraver::try_music (Music* r) { - if (Mark_req *mr = dynamic_cast (r)) - { - if (mark_req_ && mr->equal_b (mark_req_)) - return true; - if (mark_req_) - return false; - mark_req_ = mr; - return true; - } - return false; + mark_req_ = r; + return true; } @@ -190,7 +182,7 @@ Mark_engraver::process_music () ENTER_DESCRIPTION(Mark_engraver, /* descr */ "", /* creats*/ "RehearsalMark", -/* accepts */ "general-music", -/* acks */ "bar-line-interface", +/* accepts */ "mark-event", +/* acks */ "bar-line-interface", /* reads */ "rehearsalMark stavesFound", /* write */ ""); diff --git a/lily/melisma-engraver.cc b/lily/melisma-engraver.cc index 7e1353a0cd..4ab16941e2 100644 --- a/lily/melisma-engraver.cc +++ b/lily/melisma-engraver.cc @@ -23,36 +23,43 @@ public: }; +/* + HUH ? + how's this supposed to work? + */ bool Melisma_engraver::try_music (Music *m) { - if (dynamic_cast (m)) - { - SCM plain (get_property ("melismaBusy")); - SCM slur (get_property ("slurMelismaBusy")); - SCM tie (get_property ("tieMelismaBusy")); - SCM beam (get_property ("beamMelismaBusy")); + SCM plain (get_property ("melismaBusy")); + SCM slur (get_property ("slurMelismaBusy")); + SCM tie (get_property ("tieMelismaBusy")); + SCM beam (get_property ("beamMelismaBusy")); - if ((to_boolean (plain)) - || (to_boolean (slur)) - || (to_boolean (tie)) - || (to_boolean (beam))) { - - daddy_trans_->set_property ("melismaEngraverBusy",SCM_BOOL_T); - return true; - } + if ((to_boolean (plain)) + || (to_boolean (slur)) + || (to_boolean (tie)) + || (to_boolean (beam))) + { + + daddy_trans_->set_property ("melismaEngraverBusy",SCM_BOOL_T); + return true; + } + else + { + daddy_trans_->set_property ("melismaEngraverBusy",SCM_BOOL_F); + return false; } - daddy_trans_->set_property ("melismaEngraverBusy",SCM_BOOL_F); - return false; } + Melisma_engraver::Melisma_engraver() { } + ENTER_DESCRIPTION(Melisma_engraver, /* descr */ "", /* creats*/ "", -/* accepts */ "general-music", +/* accepts */ "melisma-playing-event", /* acks */ "", /* reads */ "melismaBusy slurMelismaBusy tieMelismaBusy beamMelismaBusy", /* write */ ""); diff --git a/lily/musical-request.cc b/lily/musical-request.cc index ff1f9ad557..700e4ceeb8 100644 --- a/lily/musical-request.cc +++ b/lily/musical-request.cc @@ -97,15 +97,6 @@ Text_script_req::do_equal_b (Request const* r) const t->get_mus_property ("text")); } -bool -String_number_req::do_equal_b (Request const* r) const -{ - String_number_req const* s = dynamic_cast (r); - return s && gh_equal_p (get_mus_property ("string"), - s->get_mus_property ("string")); -} - - bool Articulation_req::do_equal_b (Request const* r) const { @@ -116,4 +107,3 @@ Articulation_req::do_equal_b (Request const* r) const && get_direction () == a->get_direction (); } -ADD_MUSIC(String_number_req); diff --git a/lily/note-head-line-engraver.cc b/lily/note-head-line-engraver.cc index 77839228ff..065de4cdb8 100644 --- a/lily/note-head-line-engraver.cc +++ b/lily/note-head-line-engraver.cc @@ -39,8 +39,8 @@ protected: private: Spanner* line_; - Request* req_; - Request* last_req_; + Music* req_; + Music* last_req_; Translator* last_staff_; bool follow_; Grob* head_; @@ -63,11 +63,8 @@ Note_head_line_engraver::try_music (Music* m) { if (!req_) { - if (Glissando_req *r = dynamic_cast (m)) - { - req_ = r; - return true; - } + req_ = m; + return true; } return false; } @@ -154,7 +151,7 @@ ENTER_DESCRIPTION(Note_head_line_engraver, /* descr */ "Engrave a line between two note heads, for example a glissando. If followVoice is set, staff switches also generate a line.", /* creats*/ "Glissando VoiceFollower", -/* accepts */ "general-music", -/* acks */ "rhythmic-head-interface", +/* accepts */ "glissando-event", +/* acks */ "rhythmic-head-interface", /* reads */ "followVoice", /* write */ ""); diff --git a/lily/parser.yy b/lily/parser.yy index f67fa5363d..c81ec16121 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -1293,20 +1293,17 @@ shorthand_command_req: $$ = MY_MAKE_MUSIC("TieEvent"); } | '[' { - Music *b= MY_MAKE_MUSIC("SpanEvent"); + Music *b= MY_MAKE_MUSIC("BeamEvent"); b->set_mus_property ("span-direction", gh_int2scm (START)) ; - b->set_mus_property ("span-type", scm_makfrom0str ("beam")); $$ =b; THIS->last_beam_start_ = b->self_scm (); } | ']' { - Music *b= MY_MAKE_MUSIC("SpanEvent"); - b->set_mus_property ("span-direction", gh_int2scm (STOP)) -; - b->set_mus_property ("span-type", scm_makfrom0str ("beam")); + Music *b= MY_MAKE_MUSIC("BeamEvent"); + b->set_mus_property ("span-direction", gh_int2scm (STOP)); $$ = b; } | BREATHE { @@ -1338,7 +1335,7 @@ verbose_command_req: Music * b = MY_MAKE_MUSIC("BreakEvent"); SCM s = $2; if (!gh_number_p (s)) - s =gh_int2scm (0); + s = gh_int2scm (0); b->set_mus_property ("penalty", s); b->set_spot (THIS->here_input ()); @@ -1591,15 +1588,13 @@ close_request_parens: s->set_spot (THIS->here_input()); } | E_SMALLER { - Music *s =MY_MAKE_MUSIC("SpanEvent"); + Music *s =MY_MAKE_MUSIC("CrescendoEvent"); $$ = s; - s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo")); s->set_spot (THIS->here_input()); } | E_BIGGER { - Music *s =MY_MAKE_MUSIC("SpanEvent"); + Music *s =MY_MAKE_MUSIC("DecrescendoEvent"); $$ = s; - s->set_mus_property ("span-type", scm_makfrom0str ("decrescendo")); s->set_spot (THIS->here_input()); } ; @@ -1615,8 +1610,7 @@ open_request: open_request_parens: E_EXCLAMATION { - Music *s = MY_MAKE_MUSIC("SpanEvent"); - s->set_mus_property ("span-type", scm_makfrom0str ( "crescendo")); + Music *s = MY_MAKE_MUSIC("CrescendoEvent"); s->set_spot (THIS->here_input()); $$ = s; diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index f50c398aff..52afa1b0b8 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -279,30 +279,26 @@ Score_engraver::try_music (Music*r) { bool gotcha = Engraver_group_engraver::try_music (r); - if (!gotcha) + if (!gotcha && r->is_mus_type ("break-event")) { - if (Break_req* b = dynamic_cast (r)) - { - gotcha = true; - + gotcha = true; - SCM pen = command_column_->get_grob_property ("penalty"); - Real total_penalty = gh_number_p (pen) - ? gh_scm2double (pen) - : 0.0; + SCM pen = command_column_->get_grob_property ("penalty"); + Real total_penalty = gh_number_p (pen) + ? gh_scm2double (pen) + : 0.0; - SCM rpen = b->get_mus_property ("penalty"); - if (gh_number_p (rpen)) - total_penalty += gh_scm2double (rpen); + SCM rpen = r->get_mus_property ("penalty"); + if (gh_number_p (rpen)) + total_penalty += gh_scm2double (rpen); - if (total_penalty > 10000.0) // ugh. arbitrary. - forbid_breaks (); + if (total_penalty > 10000.0) // ugh. arbitrary. + forbid_breaks (); - command_column_->set_grob_property ("penalty", - gh_double2scm (total_penalty)); - } + command_column_->set_grob_property ("penalty", + gh_double2scm (total_penalty)); } - return gotcha; + return gotcha; } /* @@ -351,7 +347,7 @@ that there are no beams or notes that prevent a breakpoint.) ", /* creats*/ "System PaperColumn NonMusicalPaperColumn", -/* accepts */ "general-music", -/* acks */ "note-spacing-interface staff-spacing-interface", +/* accepts */ "break-event", +/* acks */ "note-spacing-interface staff-spacing-interface", /* reads */ "currentMusicalColumn currentCommandColumn", /* write */ ""); diff --git a/lily/tempo-performer.cc b/lily/tempo-performer.cc index 682a6869d4..f457b42898 100644 --- a/lily/tempo-performer.cc +++ b/lily/tempo-performer.cc @@ -23,15 +23,10 @@ protected: virtual void create_audio_elements (); private: - Tempo_req* tempo_req_; +Music* tempo_req_; Audio_tempo* audio_; }; -ENTER_DESCRIPTION (Tempo_performer, "","", - "general-music", - "","","" ); - - Tempo_performer::Tempo_performer () { tempo_req_ = 0; @@ -78,13 +73,13 @@ Tempo_performer::try_music (Music* req) if (tempo_req_) return false; - if (Tempo_req *t = - dynamic_cast (req)) - { - tempo_req_ = t; + tempo_req_ = req; return true; - } - - return false; } + + + +ENTER_DESCRIPTION (Tempo_performer, "","", + "tempo-event", + "","","" ); diff --git a/lily/translator-group.cc b/lily/translator-group.cc index 957ca17f0b..8e6e080fe7 100644 --- a/lily/translator-group.cc +++ b/lily/translator-group.cc @@ -122,8 +122,6 @@ Translator_group::find_existing_translator (String n, String id) } - - Translator_group* Translator_group::find_create_translator (String n, String id) { @@ -216,7 +214,6 @@ bool Translator_group::is_bottom_translator_b () const { return !gh_string_p (unsmob_translator_def (definition_)->default_child_context_name ()); - } Translator_group* @@ -431,12 +428,13 @@ bool Translator_group::try_music_on_nongroup_children (Music *m ) { SCM tab = get_property ("acceptHashTable"); - SCM name = scm_assq ( ly_symbol2scm ("name"), m->get_property_alist (false)); + SCM name = scm_sloppy_assq (ly_symbol2scm ("name"), + m->get_property_alist (false)); if (!gh_pair_p (name)) return false; - name = gh_car (name); + name = gh_cdr (name); SCM accept_list = scm_hashq_ref (tab, name, SCM_UNDEFINED); if (accept_list == SCM_BOOL_F) { diff --git a/scm/music-types.scm b/scm/music-types.scm index 9c87866994..a206bad008 100644 --- a/scm/music-types.scm +++ b/scm/music-types.scm @@ -9,8 +9,8 @@ )) (ArpeggioEvent . ( - (internal-class-name . "Arpeggio_req") - (types . (general-music event)) + (internal-class-name . "Request") + (types . (general-music arpeggio-event event)) )) (ArticulationEvent . ( @@ -19,40 +19,42 @@ )) (BassFigureEvent . ( - (internal-class-name . "Bass_figure_req") + (internal-class-name . "Request") (compress-procedure . ,music-duration-compress) (length . ,music-duration-length) (types . (general-music event rhythmic-event bass-figure-event)) )) + (BeamEvent + . ( + (internal-class-name . "Request") + (types . (general-music event beam-event span-event)) + )) (BreakEvent . ( - (internal-class-name . "Break_req") - - (types . (general-music event)) - )) + (internal-class-name . "Request") + (types . (general-music break-event event)) + )) (BreathingSignEvent . ( - (internal-class-name . "Breathing_sign_req") - + (internal-class-name . "Request") (types . (general-music event breathing-event)) )) (BusyPlayingEvent . ( - (internal-class-name . "Busy_playing_req") - + (internal-class-name . "Request") (types . (general-music event busy-playing-event)) )) (ExtenderEvent . ( - (internal-class-name . "Extender_req") + (internal-class-name . "Request") (types . (general-music event)) )) (GlissandoEvent . ( - (internal-class-name . "Glissando_req") + (internal-class-name . "Request") (types . (general-music event)) )) - (GraceMusic + (GraceMusic . ( (internal-class-name . "Grace_music") (iterator-ctor . ,Grace_iterator::constructor) @@ -60,13 +62,13 @@ )) (HyphenEvent . ( - (internal-class-name . "Hyphen_req") + (internal-class-name . "Request") (types . (general-music event)) )) (KeyChangeEvent . ( (internal-class-name . "Key_change_req") - (types . (general-music event)) + (types . (general-music key-change-event event)) )) (LyricEvent . ( @@ -75,21 +77,21 @@ )) (LigatureEvent . ( - (internal-class-name . "Span_req") + (internal-class-name . "Request") (span-type . ligature) (types . (general-music event span-event ligature-event)) )) (MarkEvent . ( - (internal-class-name . "Mark_req") - (types . (general-music event)) + (internal-class-name . "Request") + (types . (general-music mark-event event)) )) (MelismaEvent . ( (internal-class-name . "Melisma_playing_req") - (types . (general-music span-event event)) + (types . (general-music span-event melisma-playing-event event)) )) - (Melisma_playingEvent + (MelismaPlayingEvent . ( (internal-class-name . "Melisma_req") (types . (general-music event)) @@ -264,12 +266,13 @@ (ScriptEvent . ( (internal-class-name . "Script_req") - (types . (general-music event)) )) (SkipEvent . ( (internal-class-name . "Request") + (length . ,music-duration-length) + (compress-procedure . ,music-duration-compress) (types . (general-music event rhythmic-event skip-event)) )) (SpanEvent @@ -277,17 +280,25 @@ (internal-class-name . "Span_req") (types . (general-music event)) )) + (DecrescendoEvent + . ( + (internal-class-name . "Request") + (types . (general-music dynamic-event decrescendo-event event)) + )) + (CrescendoEvent + . ( + (internal-class-name . "Request") + (types . (general-music dynamic-event crescendo-event event)) + )) (StringNumberEvent . ( - (internal-class-name . "String_number_req") - + (internal-class-name . "Request") (types . (general-music event)) )) (TempoEvent . ( - (internal-class-name . "Tempo_req") - - (types . (general-music event)) + (internal-class-name . "Request") + (types . (general-music tempo-event event)) )) (TextScriptEvent . ( @@ -321,7 +332,7 @@ (props (hashq-ref music-name-to-property-table x '())) (name (if (pair? props) (cdr (assoc 'internal-class-name props)) - (misc-error "Can not find music object ~s" x))) + (error "Can not find music object" x))) ) (if (eq? props '()) diff --git a/scm/translator-property-description.scm b/scm/translator-property-description.scm index 729986f978..bc49a7cbdd 100644 --- a/scm/translator-property-description.scm +++ b/scm/translator-property-description.scm @@ -42,6 +42,8 @@ and therefore only work in contexts which contain an "Internal variable: store interface to engraver smob table for current context. Don't mess with this." ) +(translator-property-description 'acceptHashTable vector? "Internal +variable: store table with MusicName to Engraver entries.") (translator-property-description 'aDueText string? "text for begin of a due") (translator-property-description 'associatedVoice string? "Name of the Voice that has the melody for this LyricsVoice.") (translator-property-description 'autoBeamSettings list? "