(c) 1997, 1998, 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
+
#include "score-engraver.hh"
#include "bar-engraver.hh"
#include "staff-bar.hh"
#include "musical-request.hh"
#include "multi-measure-rest.hh"
#include "command-request.hh"
-#include "time-description.hh"
+#include "timing-engraver.hh"
#include "engraver-group-engraver.hh"
#include "warn.hh"
do_post_move_processing();
}
-bool
-Bar_engraver::do_try_music (Music*r_l)
-{
- if (Bar_req * b= dynamic_cast <Bar_req *> (r_l))
- {
- if (bar_req_l_ && bar_req_l_->equal_b (b)) // huh?
- return false;
-
- bar_req_l_ = b;
- return true;
- }
-
- return false;
-}
if (!bar_p_)
{
bar_p_ = new Staff_bar;
- bar_p_->set_elt_property (break_priority_scm_sym, gh_int2scm (0));
+ bar_p_->set_elt_property ("break-aligned", SCM_BOOL_T);
// urg: "" != empty...
- String default_type = get_property ("defaultBarType", 0);
- if (default_type.length_i ())
+ SCM default_type = get_property ("defaultBarType", 0);
+ if (gh_string_p (default_type))
{
- bar_p_->type_str_ = default_type;
+ bar_p_->set_elt_property ("glyph", default_type); // gu.h
}
+#if 0
/*
- urg. Why did I implement this?
- */
- Scalar prop = get_property ("barAtLineStart", 0);
- if (prop.to_bool ())
+ urg. Why did I implement this? And did I implement this so
+ clumsily? */
+ SCM prop = get_property ("barAtLineStart", 0);
+ if (to_boolean (prop))
{
- bar_p_->set_elt_property (at_line_start_scm_sym, SCM_BOOL_T);
+ bar_p_->set_elt_property ("at-line-start", SCM_BOOL_T);
}
- prop = get_property ("barSize", 0);
- if (prop.isnum_b ())
- {
- bar_p_->set_elt_property (bar_size_scm_sym,
- gh_double2scm (Real(prop)));
- }
- announce_element (Score_element_info (bar_p_, bar_req_l_));
+#endif
+ announce_element (Score_element_info (bar_p_, 0));
}
}
/**
Make a barline. If there are both |: and :| requested, merge them
- to :|:
+ to :|:.
*/
void
-Bar_engraver::request_bar (String type_str)
+Bar_engraver::request_bar (String requested_type)
{
- Scalar prop = get_property ("barAtLineStart", 0);
if (!now_mom ())
{
- Scalar prop = get_property ("barAtLineStart", 0);
- if (!prop.to_bool ())
+ SCM prop = get_property ("barAtLineStart", 0);
+ if (!to_boolean (prop))
return;
}
+ bool bar_existed = bar_p_;
create_bar ();
+ if (bar_existed && requested_type == "")
+ {
+ return;
+ }
- if (((type_str == "|:") && (bar_p_->type_str_ == ":|"))
- || ((type_str == ":|") && (bar_p_->type_str_ == "|:")))
- bar_p_->type_str_ = ":|:";
- else if (type_str_.length_i ())
- bar_p_->type_str_ = type_str;
+ String current = ly_scm2string (bar_p_->get_elt_property ("glyph"));
+
+ if ((requested_type == "|:" && current== ":|")
+ || (requested_type == ":|" && current == "|:"))
+ requested_type = ":|:";
+
+
+ bar_p_->set_elt_property ("glyph",
+ ly_str02scm (requested_type.ch_C ()));
}
void
Bar_engraver::do_creation_processing ()
{
- create_bar ();
- bar_p_->type_str_ = "";
}
void
void
Bar_engraver::do_process_requests()
{
- Time_description const *time = get_staff_info().time_C_;
- if (bar_req_l_)
- {
- create_bar ();
- bar_p_->type_str_ = bar_req_l_->type_str_;
- }
- else if (!now_mom ())
- {
- create_bar ();
- bar_p_->type_str_ = "|";
- }
- else
+ Translator * t = daddy_grav_l ()->get_simple_translator ("Timing_engraver");
+
+ Timing_engraver * te = dynamic_cast<Timing_engraver*>(t);
+ String which = (te) ? te->which_bar () : "";
+
+ if (which.length_i ())
{
- Scalar nonauto = get_property ("barNonAuto", 0);
- if (!nonauto.to_bool ())
- {
- Scalar always = get_property ("barAlways", 0);
- if ((time && !time->whole_in_measure_) || always.to_bool ())
- create_bar ();
- }
+ create_bar();
+ bar_p_->set_elt_property ("glyph", ly_str02scm (which.ch_C ()));
}
if (!bar_p_)
}
}
-void
-Bar_engraver::do_post_move_processing()
-{
- bar_req_l_ = 0;
-}
-
-
-
ADD_THIS_TRANSLATOR(Bar_engraver);
+