]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/time-description.cc
release: 1.0.1
[lilypond.git] / lily / time-description.cc
index b60d007ede28e403b3b1bdcf33e6ca4155b85591..22ab2d9acc761770355926bb80694538e948e555 100644 (file)
@@ -3,23 +3,23 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "time-description.hh"
 #include "debug.hh"
 
 String
-Time_description::str()const
+Time_description::str () const
 {
   String s ("Time_description { ");
   if (cadenza_b_)
-       s+=String (" (cadenza) ");
-  s+= "at ";
-  s+=when_;
-  s+="\nmeter " + String (whole_per_measure_/one_beat_) +":" +
-       String (Rational (Rational (1)/one_beat_));
-  s+= "\nposition "+String (bars_i_) + ":"+ whole_in_measure_ +"\n}\n";
+       s += String ("(") + _("cadenza") + ")";
+  s += "at ";
+  s += when_.str ();
+  s +="\ntime_signature " + (whole_per_measure_/one_beat_).str () +":" +
+        (Rational (Rational (1)/one_beat_)).str ();
+  s += "\nposition " + to_str (bars_i_) + ":"+ whole_in_measure_.str () +"\n}\n";
   return s;
 }
 
@@ -27,7 +27,7 @@ void
 Time_description::print() const
 {
 #ifndef NPRINT
-  DOUT << str();
+  DOUT << str ();
 #endif
 }
 void
@@ -44,9 +44,9 @@ Time_description::OK() const
 void
 Time_description::set_cadenza (bool b)
 {
-  if (cadenza_b_ && !b) 
+  if (cadenza_b_ && !b)
     {
-       if (whole_in_measure_) 
+       if (whole_in_measure_)
          {
            bars_i_ ++;         // should do?
            whole_in_measure_ = 0;
@@ -62,7 +62,7 @@ Time_description::Time_description()
   whole_in_measure_ =0;
   one_beat_ = Moment (1,4);
   when_ = 0;
-  bars_i_ = 0;
+  bars_i_ = 1;                 // musician start counting at 1
   cadenza_b_ = false;
 }
 
@@ -72,8 +72,8 @@ Time_description::add (Moment dt)
   assert (dt >= Rational (0));
   when_ +=  dt;
   whole_in_measure_ += dt;
-       
-  while ( !cadenza_b_ && whole_in_measure_ >= whole_per_measure_) 
+
+  while (!cadenza_b_ && whole_in_measure_ >= whole_per_measure_)
     {
        whole_in_measure_ -= whole_per_measure_;
        bars_i_ ++;
@@ -81,7 +81,7 @@ Time_description::add (Moment dt)
 }
 
 void
-Time_description::set_meter (int l, int o)
+Time_description::set_time_signature (int l, int o)
 {
   assert (o);
   one_beat_ = Rational (1)/Moment (o);
@@ -89,23 +89,23 @@ Time_description::set_meter (int l, int o)
 }
 
 bool
-Time_description::allow_meter_change_b()
+Time_description::allow_time_signature_change_b()
 {
   return!(whole_in_measure_);
 }
 
 /**
   retrieve error messages.
-  @return 
+  @return
   error messages if not possible, "" if possible
   */
 String
-Time_description::try_set_partial_str (Moment p)const
+Time_description::try_set_partial_str (Moment p) const
 {
   if (p<Rational (0))
-       return ("Partial must be non-negative");
+       return (_ ("partial measure must be non-negative"));
   if (p > whole_per_measure_)
-       return ("Partial measure too large");
+       return (_ ("partial measure too large"));
   return "";
 }
 
@@ -116,7 +116,7 @@ Time_description::setpartial (Moment p)
 }
 
 Moment
-Time_description::barleft()const
+Time_description::barleft() const
 {
   assert (!cadenza_b_);
   return whole_per_measure_-whole_in_measure_;
@@ -127,7 +127,7 @@ Time_description::compare (Time_description const &t1,  Time_description const&t
 {
   int i = sign (t1.when_-t2.when_);
 
-  if (!i) 
+  if (!i)
     {
        assert (t1.bars_i_==t2.bars_i_);
        assert (t1.one_beat_ == t2.one_beat_);
@@ -143,4 +143,3 @@ Time_description::next_bar_moment() const
 {
   return when_ + barleft();
 }
-