]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/dimension-cache.hh
9962cc2a7a19ee5ca946044ffe285a39c91870d7
[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 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7   
8  */
9
10 #ifndef DIMENSION_CACHE_HH
11 #define DIMENSION_CACHE_HH
12 #include "interval.hh"
13 #include "real.hh"
14 #include "lily-proto.hh"
15 #include "parray.hh"
16
17
18
19 class Dimension_cache
20 {
21   bool valid_b_;
22   /** Is this element dimensionless?.
23     This is private to guarantee correctness of the cache
24    */
25   bool empty_b_;
26   Interval dim_;
27   Real offset_;
28   Graphical_element *elt_l_;
29   friend class Graphical_element;
30
31   void init ();
32 public:
33   Dimension_cache * parent_l_;
34   Link_array<Dimension_cache> dependencies_l_arr_;
35   
36   Real absolute_coordinate () const;
37   void invalidate ();
38   void invalidate_dependencies ();
39   
40   Dimension_cache(Dimension_cache const&);
41   Dimension_cache ();
42   void set_group_l (Graphical_axis_group*);
43   Real relative_coordinate (Dimension_cache *d) const;
44   Dimension_cache*common_group (Dimension_cache const* s) const;
45   Dimension_cache*common_group (Link_array<Dimension_cache> caches) const;
46   void set_empty (bool);
47   void translate (Real);
48   void set_offset (Real);
49   bool valid_b () const { return valid_b_; }
50   bool empty_b() const { return empty_b_; }
51   void set_dim (Interval);
52   Interval get_dim () const;
53 };
54
55
56 #endif /* DIMENSION_CACHE_HH */
57