2 dimension-cache.cc -- implement Dimension_cache
4 source file of the GNU LilyPond music typesetter
6 (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "dimension-cache.hh"
12 Dimension_cache::Dimension_cache (Dimension_cache const &d)
15 callback_l_ = d.callback_l_;
16 empty_b_ = d.empty_b_;
17 offset_ = d.offset_; //let's hope others will copy the refpoint appropriately.
20 Dimension_cache::Dimension_cache ()
26 Dimension_cache::init()
39 Dimension_cache::invalidate ()
42 invalidate_dependencies ();
46 Dimension_cache::invalidate_dependencies ()
48 for (int i=0; i < dependencies_l_arr_.size (); i++)
50 Dimension_cache * g = dependencies_l_arr_[i];
59 Dimension_cache::set_offset (Real x)
61 invalidate_dependencies ();
66 Dimension_cache::translate (Real x)
68 invalidate_dependencies ();
74 Dimension_cache::absolute_coordinate () const
77 for (Dimension_cache * c = parent_l_;
84 what *should* these functions *do* anyway.
87 Dimension_cache::relative_coordinate (Dimension_cache *d) const
93 for (Dimension_cache* c = parent_l_;
101 Dimension_cache::common_group (Dimension_cache const* s) const
103 Link_array<Dimension_cache const> my_groups;
104 for (Dimension_cache const *c = this;
105 c ; c = c->parent_l_)
109 Dimension_cache const *common=0;
111 for (Dimension_cache const * d = s;
114 common = my_groups.find_l (d);
116 return (Dimension_cache*)common;
122 Dimension_cache::set_empty (bool b)
133 Dimension_cache::set_dim (Interval v)
141 Dimension_cache::get_dim () const
152 Dimension_cache *nc = ((Dimension_cache*)this);
153 nc->dim_= (*callback_l_ ) (nc);
158 if (!r.empty_b()) // float exception on DEC Alpha
165 Dimension_cache::set_callback (Dim_cache_callback c)
171 Dimension_cache::offset () const