]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/atom.cc
release: 1.3.28
[lilypond.git] / lily / atom.cc
index 090cad2b19d520904d032749143cfa1147baf826..9dd82bc754f88893320db90a009ea5253fb0f57a 100644 (file)
@@ -3,93 +3,53 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-#include "atom.hh"
-#include "tex.hh"
-#include "interval.hh"
-#include "dimen.hh"
-#include "string.hh"
-#include "varray.hh"
-#include "debug.hh"
-
-void
-Atom::print() const
-{
-#ifndef NPRINT
-  DOUT << "texstring: " <<tex_<<"\n";
-
-  DOUT << "dim:";
-    for (Axis i=X_AXIS; i < NO_AXES; incr(i))
-      DOUT << axis_name_str(i) << " = " << dim_[i].str();
 
-  DOUT << "\noffset: " << off_.str ();
-#endif
-}
+#include <math.h>
 
-Box
-Atom::extent() const
-{
-  Box b (dim_);
-  b.translate (off_);
-  return b;
-}
+#include "atom.hh"
+#include "lookup.hh"
+#include "global-ctor.hh"
+#include "font-metric.hh"
 
 
-Atom::Atom()
-  : dim_ (Interval (0,0),Interval (0,0))
-{
-  tex_ = "\\unknown";
-}
+#if 0
+SCM translate_sym;
 
-Atom::Atom (String s, Box b)
-  :  dim_ (b)
+static void init()
 {
-  tex_ = s;
+  translate_sym = sly_symbol2scm ("translate-atom");
 }
 
+ADD_SCM_INIT_FUNC(atom, init);
+#endif
 
-String
-Atom::str() const
+SCM
+translate_atom (Offset o, SCM func)
 {
-  return "Atom (\'"+tex_+"\', (" + dim_.x().str () + ", "
-    + dim_.y ().str () + "))";
+  return gh_list (ly_symbol2scm ("translate-atom"),
+                 ly_quote_scm (ly_offset2scm (o)),
+                 func,
+                 SCM_UNDEFINED);
 }
 
-String
-Atom::TeX_string() const
+SCM
+translate_atom_axis (Real r, Axis a, SCM func)
 {
-  String tex_str = tex_;
-  Offset off = off_;
-
-  /* infinity checks. */
-  for (int a = X_AXIS; a < NO_AXES; a++)
-    {
-      Axis ax = (Axis)a;
-      if (abs (off[ax]) >= 100 CM)
-       {
-         warning (_("ridiculous dimension ") + axis_name_str (ax)  + ", "
-                  +print_dimen(off[ax]));
-         off[ax] = 0.0;
-         tex_str += "\errormark";
-       }
-    }
-  // whugh.. Hard coded...
-  String s ("\\placebox{");
-  s += print_dimen (off[Y_AXIS])+"}{";
-  s += print_dimen (off[X_AXIS]) + "}{";
-  s += tex_str + "}";
-  return s;
+  //  off_[a] += r;
+  Offset o ;
+  o[a] = r;
+  return gh_list (ly_symbol2scm ("translate-atom"),
+                 ly_quote_scm (ly_offset2scm (o)),
+                 func,
+                 SCM_UNDEFINED);
 }
 
-void
-Atom::translate_axis (Real r, Axis a)
-{
-  off_[a] += r;
-}
 
-void
-Atom::translate (Offset o)
+SCM
+fontify_atom(Font_metric * met, SCM f)
 {
-  off_ += o;
+  return  gh_list (ly_symbol2scm ("fontify"),
+                  ly_quote_scm (met->description ()), f, SCM_UNDEFINED);
 }