InsetGraphics currently contains the following code: extern BufferView * current_view; void InsetGraphics::statusChanged() { current_view->updateInset(this, false); }
InsetGraphics::statusChanged() is connected to the signal grfx::Loader::statusChanged, emitted when the graphics file is loaded into memory (f.ex). Now InsetGraphics::draw(BufferView * bv, ...) does the drawing of the inset. My idea is to define a signal to add to InsetGraphics (or rather to the private std::auto_ptr<Cache> const cache_): boost::signal2<void, Inset * inset, bool); updateInset; and to connect it in InsetGraphics::draw: cache_->updateInset.connect( boost::bind(&BufferView::updateInset, bv, _1, _2)); We can then get rid of current_view from InsetGraphics and have void InsetGraphics::statusChanged() { cache_->updateInset(this, false); } which will call all the appropriate BufferViews. So, questions: 1. BufferView would now derive from boost::trackable. Ok? 2. Is there some function that will tell me whether a signal is already connected to a particular slot? (So that I don't conect to the same BufferView * bv multiple times in InsetGraphics::draw). 3. Is the approach "reasonable"? Angus