2004-08-13 Jan Nieuwenhuizen <janneke@gnu.org>
+ * lily/spanner.cc (spanned_rank_iv): Bugfix.
+
* lily.scm: Mark un-internationlised user messages (with FIXME).
* lily/include/modified-font-metric.hh (struct
return -2;
}
-
template<class T>
bool
Interval_t<T>::superset (Interval_t<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;
template<class T>
int
-Interval__compare (const Interval_t<T>&a,Interval_t<T> const&b)
+Interval__compare (Interval_t<T> const& a,Interval_t<T> const& b)
{
int i = _Interval__compare (a,b);
if (i < -1)
#endif
}
+#if 0 //this is called intersection
template<class T>
Interval_t<T>
intersect (Interval_t<T> x, Interval_t<T> const &y)
x.intersect (y);
return x;
}
+#endif
template<class T>
String
#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)
{
return SCM_UNSPECIFIED;
}
-
ADD_INTERFACE (Chord_name, "chord-name-interface",
"A chord name.",
"begin-of-line-visible");
-
#include "event.hh"
#include "group-interface.hh"
#include "hairpin.hh"
+#include "interval.hh"
#include "item.hh"
#include "new-slur.hh"
#include "note-column.hh"
{
Item *script_;
Spanner *line_spanner_;
- Grob *slur_;
+ Spanner *slur_;
Spanner *cresc_;
Spanner *finished_line_spanner_;
}
bool
-Dynamic_engraver::try_music (Music * m)
+Dynamic_engraver::try_music (Music *m)
{
if (m->is_mus_type ("absolute-dynamic-event"))
{
finished_line_spanner_ = line_spanner_;
line_spanner_ = 0;
typeset_all ();
- slur_ = 0;
}
script_ev_ = 0;
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));
}
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<Item*> (i.grob_));
+ Side_position_interface::add_support (line_spanner_,info.grob_);
+ add_bound_item (line_spanner_,dynamic_cast<Item*> (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.
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<Spanner*> (info.grob_);
}
ENTER_DESCRIPTION (Dynamic_engraver,
#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"
class Script_engraver : public Engraver
{
Array<Script_tuple> scripts_;
- Grob *slur_;
+ Spanner *slur_;
protected:
virtual bool try_music (Music*);
}
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;
}
}
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++)
{
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
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<Spanner*> (info.grob_);
}
void
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<Item*> (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<Item*> (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);
sc->set_property ("padding", scm_make_real (pad + ss));
}
}
- slur_ = 0;
scripts_.clear ();
}
}
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 ();
}
return true;
}
- new_slur_evs_.push (ev);
+ new_slur_evs_.push (m);
return true;
}
}
}
int
-Spanner::get_break_index ()const
+Spanner::get_break_index () const
{
return break_index_;
}
{
Interval_t<int> 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;
}