2 bar-engraver.cc -- implement Bar_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 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 "multi-measure-rest.hh"
14 #include "command-request.hh"
16 #include "engraver-group-engraver.hh"
19 #include "engraver.hh"
22 generate bars. Either user ("|:"), or default (new measure)
28 - document how barlines and line breaks interact.
30 class Bar_engraver : public Engraver
34 VIRTUAL_COPY_CONS(Translator);
35 void request_bar (String type_str);
38 virtual void do_creation_processing ();
39 virtual void do_removal_processing ();
40 virtual void do_process_music();
41 virtual void do_pre_move_processing();
50 Bar_engraver::Bar_engraver()
53 do_post_move_processing();
57 Bar_engraver::create_bar ()
61 bar_p_ = new Item (get_property ("BarLine"));
63 SCM gl = get_property ("whichBar");
64 if (scm_equal_p (gl, bar_p_->get_elt_property ("glyph")) != SCM_BOOL_T)
65 bar_p_->set_elt_property ("glyph", gl);
67 announce_element (bar_p_, 0);
72 Bar_engraver::do_creation_processing ()
77 Bar_engraver::do_removal_processing ()
83 Bar_engraver should come *after* any engravers that expect bars to
84 modify whichBar in do_process_music () be typeset
87 Bar_engraver::do_process_music()
89 SCM b =get_property ("whichBar");
97 Bar_engraver::typeset_bar ()
101 typeset_element (bar_p_);
107 lines may only be broken if there is a barline in all staffs
110 Bar_engraver::do_pre_move_processing()
114 Score_engraver * e = 0;
115 Translator * t = daddy_grav_l ();
116 for (; !e && t; t = t->daddy_trans_l_)
118 e = dynamic_cast<Score_engraver*> (t);
122 programming_error ("No score engraver!");
124 e->forbid_breaks (); // guh. Use properties!
130 ADD_THIS_TRANSLATOR(Bar_engraver);