]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/include/graphical-element.hh
release: 1.1.18
[lilypond.git] / lily / include / graphical-element.hh
index f5057a0c630428ccc13457856285c07626ba1619..465fe357001ac384593a6245aa98350615349e46 100644 (file)
@@ -3,7 +3,7 @@
 
   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 "lily-proto.hh"
 #include "interval.hh"
 #include "virtual-methods.hh"
+#include "dimension-cache.hh"
+
 
-/** The 2d geometric aspects of a score-element.  It was put in a
-  separate class, because Score_elem got quite big.
 
+/** The 2d geometric aspects of a score-element.  It was put in a
+  separate class, because Score_element got quite big.
   */
 class Graphical_element 
 {
   void init ();
-  /** Is this element dimensionless?.
-    This is private to guarantee correctness of the cache
-   */
-  bool empty_b_;
-  
 public:
+  Dimension_cache dim_cache_[NO_AXES];
+
+  char const * name () const;
   void set_empty (bool);
-  DECLARE_MY_RUNTIME_TYPEINFO;
-  /**
-    This is  needed, because #output# may still be
-    NULL.
-    */
-  Offset offset_;
-  
-  Axis_group_element * axis_group_l_a_[NO_AXES];
-  Interval cached_dimension_a_[NO_AXES];
-  bool cached_valid_b_a_[NO_AXES];
+  bool empty_b () const;
   
   Graphical_element ();
   Graphical_element (Graphical_element const&);
@@ -46,8 +37,6 @@ public:
   
   void invalidate_cache (Axis);
   Interval extent (Axis) const;
-  Interval width() const;
-  Interval height() const;
  
   /**
     translate the symbol. The symbol does not have to be created yet. 
@@ -59,16 +48,20 @@ public:
     
   void translate_axis (Real, Axis);
 
-  Real relative_coordinate (Axis_group_element*group, Axis) const;
+  Real relative_coordinate (Dimension_cache*group, Axis) const;
   Offset absolute_offset() const;
   Real absolute_coordinate (Axis) const;
   /**
     Find the group-element which has both #this# and #s#
    */
-  Axis_group_element*common_group (Graphical_element const* s, Axis a) const;
+  Dimension_cache*common_group (Graphical_element const* s, Axis a) const;
+  Dimension_cache*common_group (Link_array<Graphical_element> elems, Axis a) const;
+  
+  Graphical_element *parent_l (Axis a) const;
+  
   void unlink ();
   void junk_links ();
-  void print () const;
+  virtual void do_print () const;
 protected:
   virtual Interval do_height () const=0;
   virtual Interval do_width () const=0;