summaryrefslogtreecommitdiff
path: root/lily/balloon.cc
diff options
context:
space:
mode:
authorMike Solomon <mike@apollinemike.com>2011-03-15 06:57:49 -0400
committerMike Solomon <mike@apollinemike.com>2011-03-15 06:57:49 -0400
commit5da7795185482ec45fa47443fc5b1c3478cccc62 (patch)
tree8f57b10132ace389c77b132484cfeee96c9f3179 /lily/balloon.cc
parent766e64a52830a300841dae05235f5aa96fd330fa (diff)
Changes the spanner-placement property of FootnoteSpanner to ly:dir
Now, the annotation on a spanner will always fall on the first (LEFT or CENTER) or last (RIGHT) broken spanner if the spanner is broken. Defaults to LEFT.
Diffstat (limited to 'lily/balloon.cc')
-rw-r--r--lily/balloon.cc19
1 files changed, 6 insertions, 13 deletions
diff --git a/lily/balloon.cc b/lily/balloon.cc
index 1dfab523a8..c4efb46b68 100644
--- a/lily/balloon.cc
+++ b/lily/balloon.cc
@@ -56,29 +56,22 @@ Balloon_interface::print (SCM smob)
return internal_balloon_print (me, p, off);
}
-// ugh...code dup...hopefully can be consolidated w/ above one day
MAKE_SCHEME_CALLBACK (Balloon_interface, print_spanner, 1);
SCM
Balloon_interface::print_spanner (SCM smob)
{
Spanner *me = unsmob_spanner (smob);
- Grob *orig = me->original ();
+ Spanner *orig = dynamic_cast<Spanner *> (me->original ());
if (orig)
{
- // TODO : consolidate code dup from System::get_footnote_grobs_in_range
- int pos = orig->spanned_rank_interval ()[LEFT];
- Real spanner_placement = min (1.0,
- max (robust_scm2double (me->get_property ("spanner-placement"), -1.0),
- -1.0));
+ Direction spanner_placement = robust_scm2dir (me->get_property ("spanner-placement"), LEFT);
- spanner_placement = (spanner_placement + 1.0) / 2.0;
- int rpos = orig->spanned_rank_interval ()[RIGHT];
- pos = (int)((rpos - pos) * spanner_placement + pos + 0.5);
+ Spanner *wanted = (spanner_placement != RIGHT)
+ ? orig->broken_intos_[0]
+ : orig->broken_intos_.back ();
- if (pos < me->spanned_rank_interval () [LEFT])
- return SCM_EOL;
- if (pos >= me->spanned_rank_interval () [RIGHT] && (me->spanned_rank_interval () [RIGHT] != orig->spanned_rank_interval () [RIGHT]))
+ if (me != wanted)
return SCM_EOL;
}