]> git.donarmstrong.com Git - lilypond.git/blob - lily/include/dimension-cache.hh
release: 1.3.40
[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--2000 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 #include "dimension-cache-callback.hh"
18
19
20 /**
21   Adminstration of offset dimension info. 
22  */
23 class Dimension_cache
24 {
25   bool valid_b_;
26   Interval dim_;
27   /**
28     The offset wrt. to the center of #parent_l_#
29    */
30
31   Real extra_offset_;
32   Real basic_offset_;
33   bool off_valid_b_;
34
35   Score_element *elt_l_;
36   friend class Score_element;
37
38   void init ();
39   Array<Offset_cache_callback> off_callbacks_;
40   /**
41      What to call to find extent.  Nil means empty. 
42    */
43 public:
44   Dim_cache_callback extent_callback_l_;
45   static Interval point_dimension_callback (Dimension_cache const* );
46   Axis axis () const;
47   Real get_offset () const;
48   void set_extent_callback (Dim_cache_callback);
49   Dimension_cache * parent_l_;
50
51   Score_element *element_l () const { return elt_l_; }
52
53   Dimension_cache(Dimension_cache const&);
54   Dimension_cache ();
55
56
57   /**
58      Find the offset relative to D.  If   D equals THIS, then it is 0.
59      Otherwise, it recursively defd as
60
61      OFFSET_ + PARENT_L_->relative_coordinate (D)
62    */
63   Real relative_coordinate (Dimension_cache *d) const;
64   Dimension_cache*common_refpoint (Dimension_cache const* s) const;
65   Dimension_cache*common_refpoint (Link_array<Dimension_cache> caches) const;
66   void set_empty (bool);
67   void translate (Real);
68
69   bool valid_b () const { return valid_b_; }
70   bool empty_b() const;
71   Interval get_dim () const;
72 };
73
74
75 #endif /* DIMENSION_CACHE_HH */
76