X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fxforms%2Flyx_gui.C;h=3c7daf746b105ceba1b1cf5a18c99a0878269546;hb=c5e3aebca35f1870d0e4062e6deb15e524a1fff7;hp=bf859d2c7e2d261e3563f16ea9bb5598e136f3ad;hpb=f68a2bfb915bf590b9dd11061750b7922e5c1deb;p=lyx.git diff --git a/src/frontends/xforms/lyx_gui.C b/src/frontends/xforms/lyx_gui.C index bf859d2c7e..3c7daf746b 100644 --- a/src/frontends/xforms/lyx_gui.C +++ b/src/frontends/xforms/lyx_gui.C @@ -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 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(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); +}