]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/dimension-cache.hh
release: 1.1.29
[lilypond.git] / lily / include / dimension-cache.hh
1 /*   
2   dimension-cache.hh -- declare Dimension_cache
3   
4   source file of the GNU LilyPond music typesetter
5   
6   (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #ifndef DIMENSION_CACHE_HH
11 #define DIMENSION_CACHE_HH
12
13 #include "interval.hh"
14 #include "real.hh"
15 #include "lily-proto.hh"
16 #include "parray.hh"
17
18
19 /**
20   Adminstration of offset  dimension info. 
21  */
22 class Dimension_cache
23 {
24   bool valid_b_;
25   /** Is this element dimensionless?.
26     This is private to guarantee correctness of the cache
27    */
28   bool empty_b_;
29   Interval dim_;
30   /**
31     The offset wrt. to the center of #parent_l_#
32    */
33   Real offset_;
34   Graphical_element *elt_l_;
35   friend class Graphical_element;
36
37   void init ();
38 public:
39   /** The #offset_# is defined with regard to this graphical_element/
40     dimension_cache.  */
41   
42   Dimension_cache * parent_l_;
43   Link_array<Dimension_cache> dependencies_l_arr_;
44   Graphical_element *element_l () { return elt_l_; }
45   Real absolute_coordinate () const;
46   void invalidate ();
47   void invalidate_dependencies ();
48   
49   Dimension_cache(Dimension_cache const&);
50   Dimension_cache ();
51
52   Real relative_coordinate (Dimension_cache *d) const;
53   Dimension_cache*common_group (Dimension_cache const* s) const;
54   Dimension_cache*common_group (Link_array<Dimension_cache> caches) const;
55   void set_empty (bool);
56   void translate (Real);
57   void set_offset (Real);
58   bool valid_b () const { return valid_b_; }
59   bool empty_b() const { return empty_b_; }
60   void set_dim (Interval);
61   Interval get_dim () const;
62 };
63
64
65 #endif /* DIMENSION_CACHE_HH */
66