+2006-02-05 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ * lily/instrument-name-engraver.cc (stop_translation_timestep):
+ hack: add to axis group if not added yet. This fixes hara kiri'd
+ piano staves.
+
+ * lily/hara-kiri-group-spanner.cc
+ (force_hara_kiri_in_y_parent_callback): fix signatures.
+
+ * lily/hairpin.cc (print): check next hairpin to see whether or
+ not to be continuing.
+
2006-02-04 Jan Nieuwenhuizen <janneke@gnu.org>
* Remove trailing whitespace from makefiles.
Spanner *me_spanner = dynamic_cast<Spanner *> (me);
extract_grob_set (me, "elements", elems);
+
if (me_spanner && elems.size ())
{
Grob *common = common_refpoint_of_array (elems, me, Y_AXIS);
Hairpin::after_line_breaking (SCM smob)
{
Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
+ consider_suicide (me);
+ return SCM_UNSPECIFIED;
+}
+
+void
+Hairpin::consider_suicide (Spanner*me)
+{
Drul_array<bool> broken;
Drul_array<Item *> bounds;
Direction d = LEFT;
&& ly_is_equal (bounds[RIGHT]->get_column ()->get_property ("when"),
bounds[LEFT]->get_property ("when")))
me->suicide ();
- return SCM_UNSPECIFIED;
+
}
MAKE_SCHEME_CALLBACK (Hairpin, print, 1);
{
Spanner *me = dynamic_cast<Spanner *> (unsmob_grob (smob));
+ consider_suicide (me);
SCM s = me->get_property ("grow-direction");
if (!is_direction (s))
{
broken[d] = bounds[d]->break_status_dir () != CENTER;
}
while (flip (&d) != LEFT);
+ if (broken[RIGHT])
+ {
+ Spanner *orig = dynamic_cast<Spanner*> (me->original ());
+ if (me->get_break_index ()
+ < orig->broken_intos_.size () - 1)
+ {
+ Spanner *next = orig->broken_intos_[me->get_break_index () + 1];
+ Stencil *s = next->get_stencil ();
+ if (!s || s->is_empty ())
+ broken[RIGHT] = false;
+ }
+ }
Grob *common = bounds[LEFT]->common_refpoint (bounds[RIGHT], X_AXIS);
Drul_array<Real> x_points;
TRANSLATOR_DECLARATIONS (Hara_kiri_engraver);
};
+
+Hara_kiri_engraver::Hara_kiri_engraver ()
+{
+ interesting_ = SCM_EOL;
+}
+
void
Hara_kiri_engraver::derived_mark () const
{
}
}
-Hara_kiri_engraver::Hara_kiri_engraver ()
-{
- interesting_ = SCM_EOL;
-}
ADD_ACKNOWLEDGER (Hara_kiri_engraver, grob);
ADD_TRANSLATOR (Hara_kiri_engraver,
We can't rely on offsets and dimensions of elements in a hara-kiri
group. Use a callback to make sure that hara-kiri has been done
before asking for offsets. */
-MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, force_hara_kiri_callback, 2);
+MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, after_line_breaking, 1);
SCM
-Hara_kiri_group_spanner::force_hara_kiri_callback (SCM smob, SCM axis)
+Hara_kiri_group_spanner::after_line_breaking (SCM smob)
{
Grob *me = unsmob_grob (smob);
- (void) axis;
+ consider_suicide (me);
+ return SCM_UNSPECIFIED;
+}
- assert (scm_to_int (axis) == Y_AXIS);
+MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, force_hara_kiri_callback, 1);
+SCM
+Hara_kiri_group_spanner::force_hara_kiri_callback (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
consider_suicide (me);
return scm_from_double (0.0);
}
-MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, force_hara_kiri_in_parent_callback, 2);
+MAKE_SCHEME_CALLBACK (Hara_kiri_group_spanner, force_hara_kiri_in_y_parent_callback, 1);
SCM
-Hara_kiri_group_spanner::force_hara_kiri_in_parent_callback (SCM smob, SCM axis)
+Hara_kiri_group_spanner::force_hara_kiri_in_y_parent_callback (SCM smob)
{
Grob *daughter = unsmob_grob (smob);
- Axis a = (Axis) scm_to_int (axis);
- assert (a == Y_AXIS);
- force_hara_kiri_callback (daughter->get_parent (a)->self_scm (), axis);
+ force_hara_kiri_callback (daughter->get_parent (Y_AXIS)->self_scm ());
return scm_from_double (0.0);
}
public:
DECLARE_SCHEME_CALLBACK (print, (SCM));
DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
+ static void consider_suicide (Spanner*);
static bool has_interface (Grob *);
};
class Hara_kiri_group_spanner
{
public:
- DECLARE_SCHEME_CALLBACK (force_hara_kiri_callback, (SCM, SCM));
+ DECLARE_SCHEME_CALLBACK (force_hara_kiri_callback, (SCM));
DECLARE_SCHEME_CALLBACK (y_extent, (SCM smob));
- DECLARE_SCHEME_CALLBACK (force_hara_kiri_in_parent_callback, (SCM, SCM));
+ DECLARE_SCHEME_CALLBACK (force_hara_kiri_in_y_parent_callback, (SCM));
+ DECLARE_SCHEME_CALLBACK (after_line_breaking, (SCM));
static bool has_interface (Grob *);
static void consider_suicide (Grob *me);
static void add_interesting_item (Grob *me, Grob *n);
{
if (text_)
{
+ SCM support = get_property ("instrumentSupport");
text_->set_object ("side-support-elements",
- grob_list_to_grob_array (get_property ("instrumentSupport")));
+ grob_list_to_grob_array (support));
+
+ /*
+ Hack to get texts on piano staves to disappear.
+ */
+ if (!text_->get_parent (Y_AXIS)
+ && scm_is_pair (support))
+ {
+ Axis_group_interface::add_element (unsmob_grob (scm_car (support)),
+ text_);
+ }
text_ = 0;
}
*/
if (dynamic_cast<Spanner *> (info.grob ())
&& ((Axis_group_interface::has_interface (info.grob ())
- && Axis_group_interface::has_axis (info.grob (), Y_AXIS)))
- && !Align_interface::has_interface (info.grob ()))
+ && Axis_group_interface::has_axis (info.grob (), Y_AXIS))))
{
- SCM nl = scm_cons (info.grob ()->self_scm (),
- get_property ("instrumentSupport"));
+ if (!Align_interface::has_interface (info.grob ()))
+ {
+ SCM nl = scm_cons (info.grob ()->self_scm (),
+ get_property ("instrumentSupport"));
- context ()->set_property ("instrumentSupport", nl);
+ context ()->set_property ("instrumentSupport", nl);
+ }
}
}
Grob *after_grob = unsmob_grob (after);
Align_interface::add_element (valign_, i.grob ());
-
+
if (before_grob || after_grob)
{
Grob_array *ga = unsmob_grob_array (valign_->get_object ("elements"));
. (
(breakable . #t)
(stacking-dir . 1)
-
(positioning-done . ,ly:break-align-interface::calc-positioning-done)
(X-extent . ,ly:axis-group-interface::width)
-
(break-align-orders . ;; end of line
#((instrument-name
left-edge
(BreakAlignGroup
. (
(axes . (0))
-
(X-extent . ,ly:axis-group-interface::width)
-
(meta . ((class . Item)
(interfaces . (break-aligned-interface
axis-group-interface))))))
(InstrumentName
. (
(breakable . #t)
- (Y-offset . ,(ly:make-simple-closure `(,+ ,(ly:make-simple-closure (list ly:self-alignment-interface::y-aligned-on-self))
- ,(ly:make-simple-closure (list ly:side-position-interface::y-aligned-on-support-refpoints)))))
+ (Y-offset . ,(ly:make-simple-closure
+ `(,+ ,(ly:make-simple-closure
+ (list ly:self-alignment-interface::y-aligned-on-self))
+ ,(ly:make-simple-closure
+ (list ly:side-position-interface::y-aligned-on-support-refpoints)))))
;; This direction is for aligned_on_support_refpoints
;; (?) --hwn
(MetronomeMark
. (
-
(stencil . ,ly:text-interface::print)
-
(Y-offset . ,ly:side-position-interface::y-aligned-side)
(direction . ,UP)
(padding . 0.8)
. (
(axes . (1))
(Y-offset . ,ly:hara-kiri-group-spanner::force-hara-kiri-callback)
+
(Y-extent . ,ly:hara-kiri-group-spanner::y-extent)
(X-extent . ,ly:axis-group-interface::width)
(meta . ((class . Spanner)