On Wednesday 26 June 2002 5:12 pm, Andre Poenitz wrote:
> On Wed, Jun 26, 2002 at 04:53:59PM +0100, Angus Leeming wrote:
> > Does this compile?
>
> Not tried but I am sure it does.
>
> I've currently f*ed up my source tree...

Ok, I'll try and replace those auto_ptr<> const pimpl_ instances with 
boost::scoped_ptr. I just need to define an empty grfx::Loader d-tor 
out-of-line I think.

> And I can't see how to use the loader. Do I have to make a Loader member
> for FormulaInset? If so, how does (FormulaInset's) clone work with
> (grfx::Loader's) boost::noncopyable?

Well, I didn't think it was rocket science ;-)

Each FormulaInset will generate one graphic file I guess, right? One graphic 
file, one grfx::Loader, so yes, I think that you should have a grfx::Loader 
member variable in FormulaInset.

Your code would then look like:
void FormulaInset::FormulaInset()
{
        loader.statusChanged
                .connect(boost::bind(&FormulaInset::statusChanged, this)));
}
void FormulaInset::makePreview()
{
        string const preview_file = ...;
        loader.reset(preview_file);
}
void FormulaInset::statusChanged()
{
        if (loader_.status() == grfx::Ready)
                current_view->updateInset(this, false);
{

The inset will then redraw itself automatically when the preview file is 
available (assuming that FormulaInset::draw Does The Right Thing TM).

See my mail to the lyx-devel list:
        "Getting rid of BufferView * current_view from InsetGraphics"
for some thoughts on getting rid of current_view in such a context. 

Alternatively, show me a "better way"!!!

Angus

Reply via email to