]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bar-number-grav.cc
release: 0.1.11
[lilypond.git] / lily / bar-number-grav.cc
index 4a468119c7960e816c47670a33ec1a6ed5cf75d1..1414f7b7de6a7e7112dd315f927de0c7a34c4039 100644 (file)
 #include "text-def.hh"
 #include "command-request.hh"
 #include "bar.hh"
+#include "time-description.hh"
 
 Bar_number_grav::Bar_number_grav()
 {
-  number_i_ =1;
   script_p_ =0;
 }
 
@@ -25,27 +25,31 @@ void
 Bar_number_grav::acknowledge_element (Score_elem_info i)
 {
   if (i.origin_grav_l_arr_.size() == 1 &&
-       i.elem_l_->is_type_b (Bar::static_name()) && !script_p_) 
-         {
-
-       script_p_ = new Script;
-       Text_def *td_p =new Text_def;
-       td_p->text_str_ = number_i_++;
-       script_p_->specs_l_ = td_p;
-       script_p_->breakable_b_ = true;
-       script_p_->dir_i_ = 1;
-
-       announce_element (Score_elem_info (script_p_, &dummy));
+      i.elem_l_->is_type_b (Bar::static_name()) && !script_p_) 
+    {
+      Time_description const * time = get_staff_info().time_C_;
+      if (!time || time->cadenza_b_)
+       return ;
+      
+      script_p_ = new Script;
+      Text_def *td_p =new Text_def;
+      td_p->text_str_ = time->bars_i_;
+
+      script_p_->specs_l_ = td_p;
+      script_p_->breakable_b_ = true;
+      script_p_->dir_ = UP;
+
+      announce_element (Score_elem_info (script_p_, &dummy));
     }
 }
 
 void
 Bar_number_grav::do_pre_move_processing()
 {
-  if ( script_p_) 
+  if (script_p_) 
     {
-       typeset_element (script_p_);
-       script_p_ =0;
+      typeset_element (script_p_);
+      script_p_ =0;
     }
 }