Re: Graphics & Qt

2002-07-15 Thread John Levon

On Mon, Jul 15, 2002 at 04:17:35PM +0100, Angus Leeming wrote:

> If you feel like re-working the code, go ahead. I have no strong opinions 
> either way.

Hmm, you won't be tricked into doing my dirty work, will you ?

:)

john

-- 
"Be sure of this, O young ambition, all mortal greatness is but disease." 
- Hermann Melville



Re: Graphics & Qt

2002-07-15 Thread Angus Leeming

On Monday 15 July 2002 4:35 pm, John Levon wrote:
> On Mon, Jul 15, 2002 at 09:46:46AM +0100, Angus Leeming wrote:
> > > Another thing: how hard would it be to try and load an image via the
> > > toolkit converter /before/ doing any conversion stuff, to see if it
> > > succeeds ? Only if it fails would it then need to try converting an
> > > image
> >
> > Why would you want to do that? The loader tells us what formats it can
> > load directly. Why not trust it?
>
> Because it is less trustworthy than actually doing it. I never like
> extension-as-filetype except as fallback, and I can be sure our
> content-type guessing is not as good as Qt's. It would also solve the
> problem with not being able to load gifs because lyx won't recognise
> Qt's ability (for whatever bug that is ...)
>
> I think it is more elegant to delegate to our superiors in this regard
> first.
>
> regards
> john

If you feel like re-working the code, go ahead. I have no strong opinions 
either way.

Angus



Re: Graphics & Qt

2002-07-15 Thread John Levon

On Mon, Jul 15, 2002 at 09:46:46AM +0100, Angus Leeming wrote:

> Why would you want to do that? The loader tells us what formats it can load 
> directly. Why not trust it?

Also, the formats list is not fine-grained enough. What if Qt can't load
some weird pnm format, but lyx could convert it ? Without my suggestion,
we will just not show the figure, with, we will convert it to a loadable
format. So it's more robust too

john

-- 
"Be sure of this, O young ambition, all mortal greatness is but disease." 
- Hermann Melville



Re: Graphics & Qt

2002-07-15 Thread John Levon

On Mon, Jul 15, 2002 at 09:46:46AM +0100, Angus Leeming wrote:

> > Another thing: how hard would it be to try and load an image via the
> > toolkit converter /before/ doing any conversion stuff, to see if it
> > succeeds ? Only if it fails would it then need to try converting an
> > image
> 
> Why would you want to do that? The loader tells us what formats it can load 
> directly. Why not trust it?

Because it is less trustworthy than actually doing it. I never like
extension-as-filetype except as fallback, and I can be sure our
content-type guessing is not as good as Qt's. It would also solve the
problem with not being able to load gifs because lyx won't recognise
Qt's ability (for whatever bug that is ...)

I think it is more elegant to delegate to our superiors in this regard
first.

regards
john

-- 
"Be sure of this, O young ambition, all mortal greatness is but disease." 
- Hermann Melville



Re: Graphics & Qt

2002-07-15 Thread Angus Leeming

On Friday 12 July 2002 5:07 pm, John Levon wrote:
> Another thing: how hard would it be to try and load an image via the
> toolkit converter /before/ doing any conversion stuff, to see if it
> succeeds ? Only if it fails would it then need to try converting an
> image

Why would you want to do that? The loader tells us what formats it can load 
directly. Why not trust it?

Angus



Re: Graphics & Qt

2002-07-12 Thread John Levon

On Fri, Jul 12, 2002 at 08:26:39AM +0100, Angus Leeming wrote:

> Why not:
> class grfx::Pixmap {
> };
> 
> class grfx::Image {
> public:
>   grfx::Pixmap & getPixmap();
> };
> 
> where grfx::Pixmap is an abstract base class. Daughter classes would contain 
> the Pixmap proper (X) or QPixmap?

This still requires a static_downcast though, does it not ?

> > Also, is boost::bind() idempotent ? lyx_gui::init_graphics() gets
> > called a lot
> 
> It shouldn't. Once is enough:

I was confused with another method called init_graphics()

Another thing: how hard would it be to try and load an image via the
toolkit converter /before/ doing any conversion stuff, to see if it
succeeds ? Only if it fails would it then need to try converting an
image

regards
john
-- 
"I hope you will find the courage to keep on living 
 despite the existence of this feature."
- Richard Stallman



Re: Graphics & Qt

2002-07-12 Thread Angus Leeming

On Friday 12 July 2002 1:21 am, John Levon wrote:
> Angus what should we do about getPixmap() of Image class ?
>
> Can't xforms code do the standard static_cast to xformsImage
> so Image doesn't need to ahve getPixmap() ? A bit ugly ...

I didn't try and think about an elegant solution at the time.

Why not:
class grfx::Pixmap {
};

class grfx::Image {
public:
grfx::Pixmap & getPixmap();
};

where grfx::Pixmap is an abstract base class. Daughter classes would contain 
the Pixmap proper (X) or QPixmap?

I have no real ideas to be honest.

> Also, is boost::bind() idempotent ? lyx_gui::init_graphics() gets
> called a lot

It shouldn't. Once is enough:

Cache & Cache::get()
{
static bool start = true;
if (start) {
start = false;
lyx_gui::init_graphics();
}

// Now return the cache
static Cache singleton;
return singleton;
}

Maybe you could track that down?
Angus



Graphics & Qt

2002-07-11 Thread John Levon


Angus what should we do about getPixmap() of Image class ?

Can't xforms code do the standard static_cast to xformsImage
so Image doesn't need to ahve getPixmap() ? A bit ugly ...

Also, is boost::bind() idempotent ? lyx_gui::init_graphics() gets
called a lot

regards
john

-- 
"I hope you will find the courage to keep on living 
 despite the existence of this feature."
- Richard Stallman