On Wed, Jun 13, 2007 at 11:25:34PM +0200, Abdelrazak Younes wrote: > Andre Poenitz wrote: > > > >In the 1.6 cycle I'd like to get rid of the 'Dimension' data member in > >Inset. As a lot of insets need that member and derivation from a > >'common' 'DimInset' base was impractical I am thinking about using the > >old ATL trick: > > I think this is too complicated. A better solution IMHO is to remove the > data member altogether and put that in the BufferView (either in the > CoordCache or in in a new DimensionCache): > > class BufferView { > Dimension const & dimension(Inset const &); > } > > Maybe we also need a simple flag in Inset would then tell if the Inset > Dimension needs to be cached or not: > > class Inset { > virtual bool cacheDimension() { return false; } > };
You are certainly right when it comes to Model/View separation. The dimension cache is a 'view thing' (depends e.g. on font size), so it does not really belong _inside_ the insets. Also, insets that are way off the visible area do not need it at all. What kept me away from an 'external' solution so far was the perceived cost as we would have a O(log n) vs O(1) lookup for dimension data. With n being roughly the number of visible insets this might not even be noticable, though. Andre'