]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/molecule.hh
* VERSION (MY_PATCH_LEVEL): make 1.7.0
[lilypond.git] / lily / include / molecule.hh
index d9cd2bb11aecdd26a6adc05ab21a7e163153e3c1..a1b887066f840c23c0d782e9324bdebc887a0436 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 #ifndef MOLECULE_HH
 #define MOLECULE_HH
@@ -14,6 +14,7 @@
 #include "axes.hh"
 #include "direction.hh"
 #include "lily-guile.hh"
+#include "smobs.hh"
 
 /** a group of individually translated symbols. You can add molecules
     to the top, to the right, etc.
 
     Empty molecules have empty dimensions.  If add_at_edge is used to
     init the molecule, we assume that
-    DIMENSIONS = (Interval(0,0),Interval(0,0)
-    
+    DIMENSIONS = (Interval (0,0),Interval (0,0)
 */
-class Molecule {
-  /// can't alloc on heap.
-  void * operator new (size_t s); 
+class Molecule
+{
+  friend SCM ly_set_molecule_extent_x (SCM, SCM, SCM);
+  
   Box dim_;
   SCM expr_;
-
+  
+  DECLARE_SIMPLE_SMOBS (Molecule,);  
 public:
+  Molecule (Box, SCM s);
+  Molecule ();
+
 
+  SCM smobbed_copy () const;
   SCM get_expr () const;
-  
-  Molecule (Box, SCM s);
-  Molecule();
 
   /**
-     Set dimensions to empty, or to (Interval(0,0),Interval(0,0) */
+     Set dimensions to empty, or to (Interval (0,0),Interval (0,0) */
   void set_empty (bool);
   void add_at_edge (Axis a, Direction d, const Molecule &m, Real padding);
   void add_molecule (Molecule const &m);
@@ -62,20 +65,33 @@ public:
   /**
      align D direction in axis A.
 
-     If D == CENTER, then move the dimension(A).center() to (0,0)
+     If D == CENTER, then move the dimension (A).center () to (0,0)
 
-     Else, move so dimension(A)[D] == 0.0
+     Else, move so dimension (A)[D] == 0.0
      
    */
   void align_to (Axis a, Direction d);
   void translate_axis (Real,Axis);
   
   Interval extent (Axis) const;
-  bool empty_b() const;
+  Box extent_box () const;
+  /**
+     codify THIS into a Scheme expression.
+   */
+  SCM create_scheme () const;
+  bool empty_b () const;
+
+
+  static SCM ly_get_molecule_extent (SCM mol, SCM axis);
+  static SCM ly_set_molecule_extent_x (SCM,SCM,SCM);
+  static SCM ly_molecule_combined_at_edge (SCM,SCM,SCM,SCM,SCM);
 };
 
-SCM fontify_atom (Font_metric*, SCM atom);
 
+DECLARE_UNSMOB(Molecule,molecule);
+SCM fontify_atom (Font_metric const*, SCM atom);
+
+Molecule create_molecule (SCM brew_molecule);