]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/molecule.cc
2003 -> 2004
[lilypond.git] / lily / molecule.cc
index 29af894151e16a676a53dfd8ffa8161dbb95f8ff..552e88675c7230e994e6594e88f98a64c2d5dbd7 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include <math.h>
@@ -64,7 +64,7 @@ Molecule::translate (Offset o)
   expr_ = scm_list_n (ly_symbol2scm ("translate-molecule"),
                   ly_offset2scm (o),
                   expr_, SCM_UNDEFINED);
-  if (!empty_b ())
+  if (!is_empty ())
     dim_.translate (o);
 }
   
@@ -105,14 +105,13 @@ Molecule::set_empty (bool e)
 
 
 void
-Molecule::align_to (Axis a, Direction d)
+Molecule::align_to (Axis a, Real x)
 {
-  if (empty_b())
+  if (is_empty ())
     return ;
 
   Interval i (extent (a));
-  Real r = (d == CENTER) ? i.center () : i[d];
-  translate_axis (-r, a);
+  translate_axis (-i.linear_combination (x), a);
 }
 
 /*
@@ -122,10 +121,10 @@ void
 Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding,
                       Real minimum)
 {
-  Real my_extent= empty_b () ? 0.0 : dim_[a][d];
+  Real my_extent= is_empty () ? 0.0 : dim_[a][d];
   Interval i (m.extent (a));
   Real his_extent;
-  if (i.empty_b ())
+  if (i.is_empty ())
     {
       programming_error ("Molecule::add_at_edge: adding empty molecule.");
       his_extent = 0.0;
@@ -149,7 +148,7 @@ Molecule::add_at_edge (Axis a, Direction d, Molecule const &m, Real padding,
   while expr_ == '()
  */
 bool
-Molecule::empty_b () const
+Molecule::is_empty () const
 {
   return expr_ == SCM_EOL;
 }
@@ -174,11 +173,6 @@ int
 Molecule::print_smob (SCM , SCM port, scm_print_state *)
 {
   scm_puts ("#<Molecule ", port);
-#if 0
-  Molecule  *r = (Molecule *) ly_cdr (s);
-  String string (r->string ());
-  scm_puts ((char *)str.to_str0 (), port);
-#endif
   scm_puts (" >", port);
   
   return 1;