]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/atom.cc
release: 1.0.17
[lilypond.git] / lily / atom.cc
index 48b5c737202b1b126d42d32321c13942750ebe57..76b59197d39219634b934a0f5761588a76705558 100644 (file)
@@ -8,12 +8,12 @@
 
 
 #include "atom.hh"
-#include "tex.hh"
 #include "interval.hh"
-#include "dimension.hh"
 #include "string.hh"
 #include "array.hh"
 #include "debug.hh"
+#include "dimensions.hh"
+#include "lookup.hh"
 #include "main.hh"
 
 inline bool
@@ -29,12 +29,12 @@ Atom::check_infinity_b ()const
       if (abs (off_[ax]) >= 100 CM)
        {
          warning (_f ("ridiculous dimension: %s, %s", axis_name_str (ax),
-                  print_dimen(off_[ax])));
+                  global_lookup_l->print_dimen (off_[ax])));
          
          if (experimental_features_global_b)
            assert (false);
 
-         ((Atom*)this)->off_[ax] = 0.0;
+         ( (Atom*)this)->off_[ax] = 0.0;
          ridiculous = true;
        }
     }
@@ -44,21 +44,21 @@ Atom::check_infinity_b ()const
 
 
 void
-Atom::print() const
+Atom::print () const
 {
 #ifndef NPRINT
-  DOUT << "texstring: " << tex_ << '\n';
+  DOUT << "string: " << str_ << '\n';
 
   DOUT << "dim:";
-  for (Axis i=X_AXIS; i < NO_AXES; incr(i))
-    DOUT << axis_name_str(i) << " = " << dim_[i].str();
+  for (Axis i=X_AXIS; i < NO_AXES; incr (i))
+    DOUT << axis_name_str (i) << " = " << dim_[i].str ();
 
   DOUT << "\noffset: " << off_.str ();
 #endif
 }
 
 Box
-Atom::extent() const
+Atom::extent () const
 {
   Box b (dim_);
   b.translate (off_);
@@ -66,23 +66,30 @@ Atom::extent() const
 }
 
 
-Atom::Atom()
+Atom::Atom ()
   : dim_ (Interval (0,0),Interval (0,0))
 {
-  tex_ = "\\unknown";
+  /*
+    urg
+    We should probably make Atom an abstract base class to
+    derive Ps_atom and Tex_atom from.
+    But Atom is used as a simple type *everywhere*,
+    and we don't have virtual contructors.
+   */
+  str_ = global_lookup_l->unknown_str ();
 }
 
 Atom::Atom (String s, Box b)
   :  dim_ (b)
 {
-  tex_ = s;
+  str_ = s;
 }
 
 
 String
-Atom::str() const
+Atom::str () const
 {
-  return String ("Atom (\'") + tex_ + "\', (" + dim_.x().str () + ", "
+  return String ("Atom (\'") + str_ + "\', (" + dim_.x ().str () + ", "
     + dim_.y ().str () + "))";
 }
 
@@ -107,3 +114,9 @@ Atom::translate (Offset o)
   off_ += o;
   check_infinity_b ();
 }
+
+bool
+Atom::empty() const
+{
+  return (dim_.y().length() == 0);
+}