]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/xforms/lyx_gui.C
Compilation fix: give C_read_callback extern "C" linkage.
[lyx.git] / src / frontends / xforms / lyx_gui.C
index bf859d2c7e2d261e3563f16ea9bb5598e136f3ad..3c7daf746b105ceba1b1cf5a18c99a0878269546 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "lyx_main.h"
 #include "lyxrc.h"
+#include "lyxfont.h"
 
 // FIXME: move this stuff out again
 #include "bufferlist.h"
@@ -31,6 +32,7 @@
 #include FORMS_H_LOCATION
 #include "ColorHandler.h"
 #include "xforms_helpers.h"
+#include "xfont_loader.h"
 #ifdef USE_XFORMS_IMAGE_LOADER
 #include "xformsImage.h"
 #else
@@ -150,6 +152,18 @@ void lyx_gui::parse_init(int & argc, char * argv[])
        XSetErrorHandler(LyX_XErrHandler);
 
        lyxColorHandler.reset(new LyXColorHandler());
+       using namespace grfx;
+
+#ifdef USE_XFORMS_IMAGE_LOADER
+       // connect the image loader based on the xforms library
+       Image::newImage = boost::bind(&xformsImage::newImage);
+       Image::loadableFormats = boost::bind(&xformsImage::loadableFormats);
+#else
+       // connect the image loader based on the XPM library
+       Image::newImage = boost::bind(&ImageXPM::newImage);
+       Image::loadableFormats = boost::bind(&ImageXPM::loadableFormats);
+#endif
 }
 
 
@@ -295,24 +309,6 @@ void lyx_gui::start(string const & batch, vector<string> files)
 }
 
 
-// Called by the graphics cache to connect the appropriate frontend
-// image loading routines to the LyX kernel.
-void lyx_gui::init_graphics()
-{
-       using namespace grfx;
-
-#ifdef USE_XFORMS_IMAGE_LOADER
-       // connect the image loader based on the xforms library
-       Image::newImage = boost::bind(&xformsImage::newImage);
-       Image::loadableFormats = boost::bind(&xformsImage::loadableFormats);
-#else
-       // connect the image loader based on the XPM library
-       Image::newImage = boost::bind(&ImageXPM::newImage);
-       Image::loadableFormats = boost::bind(&ImageXPM::loadableFormats);
-#endif
-}
-
-
 string const lyx_gui::hexname(LColor::color col)
 {
        string const name = lcolor.getX11Name(col);
@@ -339,3 +335,36 @@ string const lyx_gui::hexname(LColor::color col)
        return os.str().c_str();
 }
 
+
+void lyx_gui::update_color(LColor::color col)
+{
+       lyxColorHandler->updateColor(col);
+}
+
+
+void lyx_gui::update_fonts()
+{
+       fontloader.update();
+}
+
+
+bool lyx_gui::font_available(LyXFont const & font)
+{
+       return fontloader.available(font);
+}
+
+namespace {
+
+extern "C"
+void C_read_callback(int, void * data)
+{
+       LyXComm * comm = static_cast<LyXComm *>(data); 
+       comm->read_ready();
+}
+
+}
+
+void lyx_gui::set_read_callback(int fd, LyXComm * comm)
+{
+       fl_add_io_callback(fd, FL_READ, C_read_callback, comm);
+}