On Wednesday 10 April 2002 5:26 pm, Herbert Voss wrote:
> Angus Leeming wrote:
> > why not leave the bounding box as blank until the file is loaded into LyX
> > and then set it to 0 0 image->w image->h ? That'd do the trick wouldn't
> > it?
>
> Am I right, that I have first to apply in the gui or to close it
> before getting the bb?
>
> Herbert

Since the inset is there, just add a couple of new methods to it that return 
the raw width and height if the image is loaded. 

Here's how to do the width. (I think!) The height will be a cut and paste job.

unsigned int InsetGraphics::raw_image_width() const
{       
        grfx::GCache & gc = grfx::GCache::get();
        return gc.raw_width(MakeAbsPath(params.filename));
}

unsigned int GCache::raw_width(string const & filename) const
{
        CacheType::const_iterator it = cache->find(filename);
        if (it == cache->end())
                return 0;

        return it->second->raw_width()
}

unsigned int GCacheItem::raw_width() const
{
        if (!image_.get())
                return 0;
        
        return image_->getWidth();
}

Or call them raw_dimensions and return a pair<uint, uint>. Your call.
Angus

Reply via email to