2 span-bar-grav.cc -- implement Span_bar_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "lily-guile.hh"
11 #include "bar-line.hh"
13 #include "span-bar.hh"
14 #include "engraver.hh"
19 Make bars that span multiple "staves". Catch bars, and span a
20 Span_bar over them if we find more than 2 bars. Vertical alignment
21 of staves changes the appearance of spanbars. It is up to the
22 aligner (Vertical_align_engraver, in this case, to add extra
23 dependencies to the spanbars.
26 class Span_bar_engraver
: public Engraver
29 Link_array
<Item
> bars_
;
32 TRANSLATOR_DECLARATIONS(Span_bar_engraver
);
34 virtual void acknowledge_grob (Grob_info
);
35 virtual void stop_translation_timestep ();
40 Span_bar_engraver::Span_bar_engraver ()
48 Span_bar_engraver::acknowledge_grob (Grob_info i
)
50 int depth
= i
.origin_transes (this).size ();
52 && Bar_line::has_interface (i
.grob_
))
54 Item
* it
= dynamic_cast<Item
*> (i
.grob_
);
57 if (bars_
.size () >= 2 && !spanbar_
)
59 spanbar_
= new Item (get_property ("SpanBar"));
61 spanbar_
->set_parent (bars_
[0], X_AXIS
);
63 announce_grob (spanbar_
, SCM_EOL
);
68 Span_bar_engraver::stop_translation_timestep ()
72 for (int i
=0; i
< bars_
.size () ; i
++)
73 Span_bar::add_bar (spanbar_
,bars_
[i
]);
75 SCM vissym
=ly_symbol2scm ("break-visibility");
76 SCM vis
= bars_
[0]->internal_get_grob_property (vissym
);
77 if (scm_equal_p (spanbar_
->internal_get_grob_property (vissym
), vis
) != SCM_BOOL_T
)
78 spanbar_
->internal_set_grob_property (vissym
, vis
);
80 typeset_grob (spanbar_
);
92 ENTER_DESCRIPTION(Span_bar_engraver
,
93 /* descr */ "This engraver makes cross-staff barlines: It catches all normal
94 bar lines, and draws a single span-bar across them.",
95 /* creats*/ "SpanBar",
96 /* acks */ "bar-line-interface",