2 bar-engraver.cc -- implement Bar_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 Jan Nieuwenhuizen <janneke@gnu.org>
11 #include "score-engraver.hh"
12 #include "musical-request.hh"
13 #include "engraver-group-engraver.hh"
16 #include "engraver.hh"
19 generate bars. Either user ("|:"), or default (new measure)
22 class Bar_engraver
: public Engraver
26 VIRTUAL_COPY_CONS (Translator
);
27 void request_bar (String type_str
);
30 virtual void finalize ();
31 virtual void stop_translation_timestep ();
32 virtual void create_grobs ();
41 Bar_engraver::Bar_engraver ()
47 Bar_engraver::create_bar ()
51 bar_p_
= new Item (get_property ("BarLine"));
53 SCM gl
= get_property ("whichBar");
54 if (scm_equal_p (gl
, bar_p_
->get_grob_property ("glyph")) != SCM_BOOL_T
)
55 bar_p_
->set_grob_property ("glyph", gl
);
57 announce_grob (bar_p_
, 0);
62 Bar_engraver::finalize ()
68 Bar_engraver should come *after* any engravers that
72 Bar_engraver::create_grobs ()
74 if (!bar_p_
&& gh_string_p (get_property ("whichBar")))
81 Bar_engraver::typeset_bar ()
85 typeset_grob (bar_p_
);
91 lines may only be broken if there is a barline in all staves
94 Bar_engraver::stop_translation_timestep ()
98 Score_engraver
* e
= 0;
99 Translator
* t
= daddy_grav_l ();
100 for (; !e
&& t
; t
= t
->daddy_trans_l_
)
102 e
= dynamic_cast<Score_engraver
*> (t
);
106 programming_error ("No score engraver!");
108 e
->forbid_breaks (); // guh. Use properties!
114 ADD_THIS_TRANSLATOR (Bar_engraver
);