From: Jan Nieuwenhuizen Date: Fri, 13 Aug 2004 20:14:02 +0000 (+0000) Subject: (spanned_rank_iv): Bugfix. X-Git-Tag: release/2.3.13~75 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=16e71c11296fe1291636907b77c32be93d3b4e7c;p=lilypond.git (spanned_rank_iv): Bugfix. --- diff --git a/ChangeLog b/ChangeLog index 488fa46b0e..6d1cc98b0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2004-08-13 Jan Nieuwenhuizen + * lily/spanner.cc (spanned_rank_iv): Bugfix. + * lily.scm: Mark un-internationlised user messages (with FIXME). * lily/include/modified-font-metric.hh (struct diff --git a/flower/include/interval.tcc b/flower/include/interval.tcc index 4284ac2bdf..afa4e9cf9a 100644 --- a/flower/include/interval.tcc +++ b/flower/include/interval.tcc @@ -32,12 +32,11 @@ _Interval__compare (const Interval_t&a,Interval_t const&b) return -2; } - template bool Interval_t::superset (Interval_t const& a) const { - int c_i= _Interval__compare (*this, a); + int c_i = _Interval__compare (*this, a); if (c_i == -2) return false; return c_i >= 0; @@ -45,7 +44,7 @@ Interval_t::superset (Interval_t const& a) const template int -Interval__compare (const Interval_t&a,Interval_t const&b) +Interval__compare (Interval_t const& a,Interval_t const& b) { int i = _Interval__compare (a,b); if (i < -1) @@ -108,6 +107,7 @@ Interval_t::intersect (Interval_t h) #endif } +#if 0 //this is called intersection template Interval_t intersect (Interval_t x, Interval_t const &y) @@ -115,6 +115,7 @@ intersect (Interval_t x, Interval_t const &y) x.intersect (y); return x; } +#endif template String diff --git a/lily/chord-name.cc b/lily/chord-name.cc index ce7099fa7d..b7c019e322 100644 --- a/lily/chord-name.cc +++ b/lily/chord-name.cc @@ -16,7 +16,7 @@ #include "staff-symbol-referencer.hh" #include "text-item.hh" -MAKE_SCHEME_CALLBACK (Chord_name,after_line_breaking,1); +MAKE_SCHEME_CALLBACK (Chord_name, after_line_breaking, 1); SCM Chord_name::after_line_breaking (SCM smob) { @@ -33,8 +33,6 @@ Chord_name::after_line_breaking (SCM smob) return SCM_UNSPECIFIED; } - ADD_INTERFACE (Chord_name, "chord-name-interface", "A chord name.", "begin-of-line-visible"); - diff --git a/lily/dynamic-engraver.cc b/lily/dynamic-engraver.cc index 95e2c7df29..76dc123384 100644 --- a/lily/dynamic-engraver.cc +++ b/lily/dynamic-engraver.cc @@ -14,6 +14,7 @@ #include "event.hh" #include "group-interface.hh" #include "hairpin.hh" +#include "interval.hh" #include "item.hh" #include "new-slur.hh" #include "note-column.hh" @@ -44,7 +45,7 @@ class Dynamic_engraver : public Engraver { Item *script_; Spanner *line_spanner_; - Grob *slur_; + Spanner *slur_; Spanner *cresc_; Spanner *finished_line_spanner_; @@ -89,7 +90,7 @@ Dynamic_engraver::Dynamic_engraver () } bool -Dynamic_engraver::try_music (Music * m) +Dynamic_engraver::try_music (Music *m) { if (m->is_mus_type ("absolute-dynamic-event")) { @@ -277,7 +278,6 @@ Dynamic_engraver::stop_translation_timestep () finished_line_spanner_ = line_spanner_; line_spanner_ = 0; typeset_all (); - slur_ = 0; } script_ev_ = 0; @@ -320,11 +320,15 @@ Dynamic_engraver::typeset_all () which are unacceptable, but it most probably breaks for more interesting cases. Maybe make a new colission engraver. */ - if (finished_line_spanner_ && slur_ - && get_slur_dir (slur_) == get_grob_direction (finished_line_spanner_)) + if (finished_line_spanner_ + && slur_ + && get_slur_dir (slur_) == get_grob_direction (finished_line_spanner_) + && !intersection (slur_->spanned_rank_iv (), + finished_line_spanner_->spanned_rank_iv ()).is_empty ()) { Real ss = Staff_symbol_referencer::staff_space (finished_line_spanner_); - Real pad = robust_scm2double (finished_line_spanner_->get_property ("padding"), 0); + Real pad = robust_scm2double (finished_line_spanner_ + ->get_property ("padding"), 0); /* FIXME: 1ss padding hardcoded */ finished_line_spanner_->set_property ("padding", scm_make_real (pad + ss)); @@ -382,31 +386,31 @@ Dynamic_engraver::typeset_all () } void -Dynamic_engraver::acknowledge_grob (Grob_info i) +Dynamic_engraver::acknowledge_grob (Grob_info info) { if (!line_spanner_) return; - if (Note_column::has_interface (i.grob_)) + if (Note_column::has_interface (info.grob_)) { if (line_spanner_ /* Don't refill killed spanner */ && line_spanner_->is_live ()) { - Side_position_interface::add_support (line_spanner_,i.grob_); - add_bound_item (line_spanner_,dynamic_cast (i.grob_)); + Side_position_interface::add_support (line_spanner_,info.grob_); + add_bound_item (line_spanner_,dynamic_cast (info.grob_)); } if (script_ && !script_->get_parent (X_AXIS)) { - SCM head = scm_last_pair (i.grob_->get_property ("note-heads")); + SCM head = scm_last_pair (info.grob_->get_property ("note-heads")); if (ly_c_pair_p (head)) script_->set_parent (unsmob_grob (ly_car (head)), X_AXIS); } } - else if (Script_interface::has_interface (i.grob_) && script_) + else if (Script_interface::has_interface (info.grob_) && script_) { - SCM p = i.grob_->get_property ("script-priority"); + SCM p = info.grob_->get_property ("script-priority"); /* UGH. @@ -416,10 +420,10 @@ Dynamic_engraver::acknowledge_grob (Grob_info i) if (ly_c_number_p (p) && ly_scm2int (p) < ly_scm2int (script_->get_property ("script-priority"))) - Side_position_interface::add_support (line_spanner_, i.grob_); + Side_position_interface::add_support (line_spanner_, info.grob_); } - else if (New_slur::has_interface (i.grob_) && line_spanner_) - slur_ = i.grob_; + else if (New_slur::has_interface (info.grob_)) + slur_ = dynamic_cast (info.grob_); } ENTER_DESCRIPTION (Dynamic_engraver, diff --git a/lily/script-engraver.cc b/lily/script-engraver.cc index 45fbb9d71c..b8e93c6cd0 100644 --- a/lily/script-engraver.cc +++ b/lily/script-engraver.cc @@ -12,6 +12,7 @@ #include "event.hh" #include "new-slur.hh" #include "note-column.hh" +#include "paper-column.hh" #include "rhythmic-head.hh" #include "script-interface.hh" #include "side-position-interface.hh" @@ -35,7 +36,7 @@ struct Script_tuple class Script_engraver : public Engraver { Array scripts_; - Grob *slur_; + Spanner *slur_; protected: virtual bool try_music (Music*); @@ -53,20 +54,20 @@ Script_engraver::Script_engraver () } bool -Script_engraver::try_music (Music *r) +Script_engraver::try_music (Music *m) { - if (r->is_mus_type ("articulation-event")) + if (m->is_mus_type ("articulation-event")) { /* Discard double articulations for part-combining. */ int script_count = scripts_.size (); for (int i = 0; i < script_count; i++) if (ly_c_equal_p (scripts_[i].event_ ->get_property ("articulation-type"), - r->get_property ("articulation-type"))) + m->get_property ("articulation-type"))) return true; Script_tuple t; - t.event_ = r; + t.event_ = m; scripts_.push (t); return true; } @@ -146,24 +147,24 @@ Script_engraver::process_music () } void -Script_engraver::acknowledge_grob (Grob_info inf) +Script_engraver::acknowledge_grob (Grob_info info) { int script_count = scripts_.size (); - if (Stem::has_interface (inf.grob_)) + if (Stem::has_interface (info.grob_)) { for (int i = 0; i < script_count; i++) { Grob *e = scripts_[i].script_; if (to_dir (e->get_property ("side-relative-direction"))) - e->set_property ("direction-source", inf.grob_->self_scm ()); + e->set_property ("direction-source", info.grob_->self_scm ()); /* FIXME: add dependency */ - e->add_dependency (inf.grob_); - Side_position_interface::add_support (e, inf.grob_); + e->add_dependency (info.grob_); + Side_position_interface::add_support (e, info.grob_); } } - else if (Rhythmic_head::has_interface (inf.grob_)) + else if (Rhythmic_head::has_interface (info.grob_)) { for (int i = 0; i < script_count; i++) { @@ -172,13 +173,13 @@ Script_engraver::acknowledge_grob (Grob_info inf) if (Side_position_interface::get_axis (e) == X_AXIS && !e->get_parent (Y_AXIS)) { - e->set_parent (inf.grob_, Y_AXIS); - e->add_dependency (inf.grob_); // ?? + e->set_parent (info.grob_, Y_AXIS); + e->add_dependency (info.grob_); } - Side_position_interface::add_support (e,inf.grob_); + Side_position_interface::add_support (e,info.grob_); } } - else if (Note_column::has_interface (inf.grob_)) + else if (Note_column::has_interface (info.grob_)) { /* Make note column the parent of the script. That is not correct, but due to seconds in a chord, noteheads may be @@ -192,11 +193,11 @@ Script_engraver::acknowledge_grob (Grob_info inf) if (!e->get_parent (X_AXIS) && Side_position_interface::get_axis (e) == Y_AXIS) - e->set_parent (inf.grob_, X_AXIS); + e->set_parent (info.grob_, X_AXIS); } } - else if (New_slur::has_interface (inf.grob_) && script_count) - slur_ = inf.grob_; + else if (New_slur::has_interface (info.grob_)) + slur_ = dynamic_cast (info.grob_); } void @@ -227,9 +228,35 @@ Script_engraver::stop_translation_timestep () Assume that a SCRIPT that should collide with SLUR does not have a negative priority. */ SCM priority = sc->get_property ("script-priority"); + +#if 0 + // this segfaults... + int rank = Paper_column::get_rank (sc); +#endif + + int rank = -1; +#if 1 + // this always yields -1 + if (Item *i = dynamic_cast (sc)) + if (i->get_column ()) + rank = i->get_column ()->rank_; +#else + // this always yields -1 + for (Grob *p = sc; p && rank < 0; p = p->get_parent (Y_AXIS)) + { + if (Item *i = dynamic_cast (p)) + if (i->get_column ()) + rank = i->get_column ()->rank_; + } +#endif + if (robust_scm2int (priority, 0) >= 0 && slur_ - && get_grob_direction (sc) == get_slur_dir (slur_)) + && get_grob_direction (sc) == get_slur_dir (slur_) + && (slur_->spanned_rank_iv ().contains (rank) + /* I'm a bit out of ideas about and time to search for + how to get our rank. Sue me. */ + || rank == -1)) { Real ss = Staff_symbol_referencer::staff_space (sc); Real pad = robust_scm2double (sc->get_property ("padding"), 0); @@ -238,7 +265,6 @@ Script_engraver::stop_translation_timestep () sc->set_property ("padding", scm_make_real (pad + ss)); } } - slur_ = 0; scripts_.clear (); } diff --git a/lily/slur-engraver.cc b/lily/slur-engraver.cc index 695bfb505d..a8cbd27598 100644 --- a/lily/slur-engraver.cc +++ b/lily/slur-engraver.cc @@ -43,19 +43,19 @@ Slur_engraver::Slur_engraver () } bool -Slur_engraver::try_music (Music *ev) +Slur_engraver::try_music (Music *m) { - if (ev->is_mus_type ("slur-event")) + if (m->is_mus_type ("slur-event")) { /* Let's not start more than one slur per moment. */ - Direction d = to_dir (ev->get_property ("span-direction")); + Direction d = to_dir (m->get_property ("span-direction")); if (d == START) { if (now_mom () > last_start_) { - new_slur_evs_.push (ev); + new_slur_evs_.push (m); last_start_ = now_mom (); } @@ -78,7 +78,7 @@ Slur_engraver::try_music (Music *ev) return true; } - new_slur_evs_.push (ev); + new_slur_evs_.push (m); return true; } } diff --git a/lily/spanner.cc b/lily/spanner.cc index 69ed46231c..058cc2f0ba 100644 --- a/lily/spanner.cc +++ b/lily/spanner.cc @@ -124,7 +124,7 @@ Spanner::do_break_processing () } int -Spanner::get_break_index ()const +Spanner::get_break_index () const { return break_index_; } @@ -146,14 +146,10 @@ Spanner::spanned_rank_iv () { Interval_t iv (0, 0); - if (spanned_drul_[LEFT]) - { - iv[LEFT] = Paper_column::get_rank (spanned_drul_[LEFT]->get_column ()); - } - if (spanned_drul_[RIGHT]) - { - iv[RIGHT] = Paper_column::get_rank (spanned_drul_[RIGHT]->get_column ()); - } + if (spanned_drul_[LEFT] && spanned_drul_[LEFT]->get_column ()) + iv[LEFT] = Paper_column::get_rank (spanned_drul_[LEFT]->get_column ()); + if (spanned_drul_[RIGHT] && spanned_drul_[RIGHT]->get_column ()) + iv[RIGHT] = Paper_column::get_rank (spanned_drul_[RIGHT]->get_column ()); return iv; }