/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 2004--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ Copyright (C) 2004--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Grob *p = me->get_parent (X_AXIS);
Offset off (me->relative_coordinate (p, X_AXIS),
- me->relative_coordinate (p, Y_AXIS));
+ me->relative_coordinate (p, Y_AXIS));
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;
}
-
Spanner *p = dynamic_cast<Spanner *> (me->get_parent (Y_AXIS));
if (!p)
return SCM_EOL;
Offset off (me->relative_coordinate (me->get_bound (LEFT), X_AXIS),
- me->relative_coordinate (p, Y_AXIS));
+ me->relative_coordinate (p, Y_AXIS));
return internal_balloon_print (me, p, off);
}
Balloon_interface::internal_balloon_print (Grob *me, Grob *p, Offset off)
{
Box b (p->extent (p, X_AXIS),
- p->extent (p, Y_AXIS));
+ p->extent (p, Y_AXIS));
Real padding = robust_scm2double (me->get_property ("padding"), .1);
b.widen (padding, padding);
SCM bt = me->get_property ("text");
SCM chain = Font_interface::text_font_alist_chain (me);
-
SCM stencil = Text_interface::interpret_markup (me->layout ()->self_scm (),
- chain, bt);
-
+ chain, bt);
Stencil *text_stil = unsmob_stencil (stencil);
Offset z1;
+
for (int i = X_AXIS; i < NO_AXES; i++)
{
Axis a ((Axis)i);
}
ADD_INTERFACE (Balloon_interface,
- "A collection of routines to put text balloons around an"
- " object.",
-
- /* properties */
- "annotation-balloon "
- "annotation-line "
- "padding "
- "spanner-placement "
- "text "
- );
+ "A collection of routines to put text balloons around an"
+ " object.",
+
+ /* properties */
+ "annotation-balloon "
+ "annotation-line "
+ "padding "
+ "spanner-placement "
+ "text "
+ );