]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bar-engraver.cc
release: 1.3.54
[lilypond.git] / lily / bar-engraver.cc
index 92378ccbd8152f1fe14f9d9d3707504675b77e09..2a8c2ae66d306e42f1bca3f29fffed08d01714c7 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997, 1998, 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
@@ -23,32 +23,24 @@ Bar_engraver::Bar_engraver()
   do_post_move_processing();
 }
 
-
-
-
 void
 Bar_engraver::create_bar ()
 {
   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-align-symbol", ly_symbol2scm ("Staff_bar"));
 
       // urg: "" != empty...
-      SCM default_type = get_property ("defaultBarType", 0);
-      if (gh_string_p (default_type))
-       {
-         bar_p_->type_str_ = ly_scm2string (default_type);
-       }
-
       /*
-       urg.  Why did I implement this?
+       TODO: use symbol.
        */
-      SCM prop = get_property ("barAtLineStart", 0);
-      if (gh_boolean_p (prop) && gh_scm2bool (prop))
+      SCM default_type = get_property ("defaultBarType");
+      if (gh_string_p (default_type))
        {
-         bar_p_->set_elt_property (at_line_start_scm_sym, SCM_BOOL_T);
+         bar_p_->set_elt_property ("glyph", default_type); // ugh
        }
+
       announce_element (Score_element_info (bar_p_, 0));
     }
 }
@@ -63,8 +55,8 @@ Bar_engraver::request_bar (String requested_type)
 {
   if (!now_mom ())
     {
-      SCM prop = get_property ("barAtLineStart", 0);
-      if (!gh_boolean_p (prop) && gh_scm2bool (prop))
+      SCM prop = get_property ("barAtLineStart");
+      if (!to_boolean (prop))
        return;
     }
   bool  bar_existed = bar_p_;
@@ -73,11 +65,16 @@ Bar_engraver::request_bar (String requested_type)
     {
       return;
     }
-  else if (((requested_type == "|:") && (bar_p_->type_str_ == ":|"))
-    || ((requested_type == ":|") && (bar_p_->type_str_ == "|:")))
-    bar_p_->type_str_ = ":|:";
-  else
-    bar_p_->type_str_ = requested_type;
+
+  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 
@@ -96,7 +93,7 @@ Bar_engraver::do_removal_processing ()
 }
 
 void
-Bar_engraver::do_process_requests()
+Bar_engraver::do_process_music()
 {  
   Translator * t = daddy_grav_l  ()->get_simple_translator ("Timing_engraver");
 
@@ -106,7 +103,7 @@ Bar_engraver::do_process_requests()
   if (which.length_i ())
     {
       create_bar();
-      bar_p_->type_str_ = which;
+      bar_p_->set_elt_property ("glyph",  ly_str02scm (which.ch_C ()));
     }
   
   if (!bar_p_)
@@ -139,3 +136,4 @@ Bar_engraver::do_pre_move_processing()
 ADD_THIS_TRANSLATOR(Bar_engraver);
 
 
+