The current method that is used for LyXImage is pretty ugly, the header
file LyXImage.h includes the right header file for the frontend by using
the preprocessor.

My problem is that I need the different LyXImage objects to have different
signatures, the X-Server version uses Pixmap, possibly the Gnome frontend
will use something else (either from imlib or gdk_pixbuf), and the windows
version will need to use something completely different.

But anyhow the only interaction done with LyXImage is loading it by the
various image loaders for the various frontends, holding it as a pointer
or a reference wherever its needed (InsetGraphics for example) and
displaying it by using a Painter method that accepts LyXImage. So
effectively except the specialized parts (ImageLoader and Painter) nothing
else needs to know about the methods of LyXImage, except to construct it
and possibly not even that (by using pointers).

The problem is that LyX is compiled with the -fno-rtti option, so I'm
unable to use a dynamic_cast to get the true type of the object. The
initial idea was to use a simple LyXImage, where the ImageLoader creates
the appropriate LyXImage, the others know nothing about it and the Painter
dynamically casts the LyXImage to the one it knows to handle (for example
LyXImage_X). Without RTTI (RunTime Type Information) this is impossible. 

So, how do I solve this? Can we remove the -fno-rtti flag? Any other C++
idiom that I should use?

-- 
  Baruch Even

http://techst02.technion.ac.il/~sbaruch/   (My Site)
http://www.redrival.com/jindor/            (My brothers AD&D site)

" Learn to laugh ... it's the path to true love! " 
   - The Angel in the movie Michael


Reply via email to