2 bar-engraver.cc -- implement Bar_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "bar-line.hh"
11 #include "score-engraver.hh"
15 #include "translator.icc"
18 generate bars. Either user ("|:"), or default (new measure)
20 class Bar_engraver : public Engraver
23 TRANSLATOR_DECLARATIONS (Bar_engraver);
24 void request_bar (String type_string);
27 virtual void finalize ();
28 void stop_translation_timestep ();
29 void process_acknowledged ();
38 Bar_engraver::Bar_engraver ()
44 Bar_engraver::create_bar ()
48 bar_ = make_item ("BarLine", SCM_EOL);
49 SCM gl = get_property ("whichBar");
50 if (scm_equal_p (gl, bar_->get_property ("glyph")) != SCM_BOOL_T)
51 bar_->set_property ("glyph", gl);
56 Bar_engraver::finalize ()
62 Bar_engraver should come *after* any engravers that
65 This is a little hairy : whichBar may be set by
66 Repeat_acknowledge_engraver::process_music, which is at score
67 context. This means that grobs could should be created after
68 process_music. We do stuff process_acknowledged (), just to be
73 Bar_engraver::process_acknowledged ()
75 if (!bar_ && scm_is_string (get_property ("whichBar")))
80 Bar_engraver::typeset_bar ()
86 lines may only be broken if there is a barline in all staves
89 Bar_engraver::stop_translation_timestep ()
92 /* guh. Use properties! */
93 get_score_engraver ()->forbid_breaks ();
98 ADD_TRANSLATOR (Bar_engraver,
99 /* doc */ "Create barlines. This engraver is controlled through the "
100 "@code{whichBar} property. If it has no bar line to create, it will forbid a linebreak at this point",
101 /* create */ "BarLine",
103 /* read */ "whichBar",