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 "bar-engraver.hh"
13 #include "musical-request.hh"
14 #include "multi-measure-rest.hh"
15 #include "command-request.hh"
16 #include "timing-engraver.hh"
17 #include "engraver-group-engraver.hh"
21 Bar_engraver::Bar_engraver()
24 do_post_move_processing();
28 Bar_engraver::create_bar ()
32 bar_p_ = new Item (get_property ("basicBarProperties"));
34 SCM default_type = get_property ("defaultBarType");
35 if (gh_string_p (default_type))
37 bar_p_->set_elt_property ("glyph", default_type); // ugh
40 announce_element (bar_p_, 0);
45 Make a barline. If there are both |: and :| requested, merge them
49 Bar_engraver::request_bar (String requested_type)
53 SCM prop = get_property ("barAtLineStart");
54 if (!to_boolean (prop))
57 bool bar_existed = bar_p_;
59 if (bar_existed && requested_type == "")
64 String current = ly_scm2string (bar_p_->get_elt_property ("glyph"));
66 if ((requested_type == "|:" && current== ":|")
67 || (requested_type == ":|" && current == "|:"))
68 requested_type = ":|:";
71 bar_p_->set_elt_property ("glyph",
72 ly_str02scm (requested_type.ch_C ()));
76 Bar_engraver::do_creation_processing ()
81 Bar_engraver::do_removal_processing ()
85 typeset_element (bar_p_);
91 Bar_engraver::do_process_music()
93 Translator * t = daddy_grav_l ()->get_simple_translator ("Timing_engraver"); // UGH.!
95 Timing_engraver * te = dynamic_cast<Timing_engraver*>(t);
96 String which = (te) ? te->which_bar () : "";
98 if (which.length_i ())
101 bar_p_->set_elt_property ("glyph", ly_str02scm (which.ch_C ()));
106 Score_engraver * e = 0;
107 Translator * t = daddy_grav_l ();
108 for (; !e && t; t = t->daddy_trans_l_)
110 e = dynamic_cast<Score_engraver*> (t);
114 programming_error ("No score engraver!");
122 Bar_engraver::do_pre_move_processing()
126 typeset_element (bar_p_);
131 ADD_THIS_TRANSLATOR(Bar_engraver);