2002-06-12 09:47:10 +00:00
|
|
|
|
/**
|
2002-09-26 08:57:43 +00:00
|
|
|
|
* \file xforms/lyx_gui.C
|
2002-09-05 15:14:23 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-06-12 09:47:10 +00:00
|
|
|
|
*
|
2003-05-14 09:17:22 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2002-11-04 00:15:56 +00:00
|
|
|
|
* \author John Levon
|
2002-09-05 14:10:50 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-06-12 09:47:10 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
#include "lyx_gui.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
#include "ColorHandler.h"
|
|
|
|
|
#include "xfont_loader.h"
|
|
|
|
|
#include "xforms_helpers.h"
|
|
|
|
|
#include "xformsImage.h"
|
|
|
|
|
#include "XFormsView.h"
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2003-09-05 13:15:43 +00:00
|
|
|
|
#include "bufferlist.h"
|
|
|
|
|
#include "BufferView.h"
|
2002-06-12 09:47:10 +00:00
|
|
|
|
#include "debug.h"
|
|
|
|
|
#include "gettext.h"
|
|
|
|
|
#include "lyx_main.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
#include "lyxfunc.h"
|
2002-06-12 09:47:10 +00:00
|
|
|
|
#include "lyxrc.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
#include "lyxserver.h"
|
|
|
|
|
|
2003-02-25 11:20:59 +00:00
|
|
|
|
#include "graphics/LoaderQueue.h"
|
2002-06-12 09:47:10 +00:00
|
|
|
|
|
2003-09-05 13:15:43 +00:00
|
|
|
|
#include "support/lyxlib.h"
|
|
|
|
|
#include "support/os.h"
|
|
|
|
|
#include "support/filetools.h"
|
|
|
|
|
#include "support/path_defines.h"
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2003-05-14 09:17:22 +00:00
|
|
|
|
#include "lyx_forms.h"
|
2003-09-05 13:15:43 +00:00
|
|
|
|
|
|
|
|
|
#include <boost/bind.hpp>
|
2002-06-12 09:47:10 +00:00
|
|
|
|
|
2003-09-05 17:23:11 +00:00
|
|
|
|
#include "support/std_sstream.h"
|
2002-07-05 21:24:15 +00:00
|
|
|
|
#include <iomanip>
|
2002-06-12 09:47:10 +00:00
|
|
|
|
#include <fcntl.h>
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2003-09-09 22:13:45 +00:00
|
|
|
|
using lyx::support::AddName;
|
|
|
|
|
using lyx::support::os;
|
|
|
|
|
using lyx::support::user_lyxdir;
|
2003-06-30 23:56:22 +00:00
|
|
|
|
|
2002-06-12 14:50:27 +00:00
|
|
|
|
#ifndef CXX_GLOBAL_CSTD
|
|
|
|
|
using std::exit;
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-07-25 18:15:33 +00:00
|
|
|
|
using std::dec;
|
2002-06-12 09:47:10 +00:00
|
|
|
|
using std::endl;
|
2003-09-05 13:15:43 +00:00
|
|
|
|
using std::hex;
|
2002-07-05 21:24:15 +00:00
|
|
|
|
using std::setbase;
|
|
|
|
|
using std::setfill;
|
|
|
|
|
using std::setw;
|
2003-09-05 18:02:24 +00:00
|
|
|
|
using std::ostringstream;
|
2003-09-05 13:15:43 +00:00
|
|
|
|
using std::vector;
|
|
|
|
|
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
extern BufferList bufferlist;
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
// FIXME: wrong place !
|
|
|
|
|
LyXServer * lyxserver;
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
namespace {
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-07-22 18:56:04 +00:00
|
|
|
|
/// quit lyx
|
|
|
|
|
bool finished = false;
|
|
|
|
|
|
2002-08-20 16:42:41 +00:00
|
|
|
|
/// estimate DPI from X server
|
|
|
|
|
float getDPI()
|
|
|
|
|
{
|
|
|
|
|
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
|
|
|
|
|
return ((HeightOfScreen(scr) * 25.4 / HeightMMOfScreen(scr)) +
|
2002-11-04 00:15:56 +00:00
|
|
|
|
(WidthOfScreen(scr) * 25.4 / WidthMMOfScreen(scr))) / 2;
|
2002-08-20 16:42:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-11-04 00:15:56 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
/// set default GUI configuration
|
|
|
|
|
void setDefaults()
|
|
|
|
|
{
|
|
|
|
|
FL_IOPT cntl;
|
|
|
|
|
cntl.buttonFontSize = FL_NORMAL_SIZE;
|
|
|
|
|
cntl.browserFontSize = FL_NORMAL_SIZE;
|
|
|
|
|
cntl.labelFontSize = FL_NORMAL_SIZE;
|
|
|
|
|
cntl.choiceFontSize = FL_NORMAL_SIZE;
|
|
|
|
|
cntl.inputFontSize = FL_NORMAL_SIZE;
|
|
|
|
|
cntl.menuFontSize = FL_NORMAL_SIZE;
|
|
|
|
|
cntl.borderWidth = -1;
|
|
|
|
|
cntl.vclass = FL_DefaultVisual;
|
|
|
|
|
fl_set_defaults(FL_PDVisual
|
|
|
|
|
| FL_PDButtonFontSize
|
|
|
|
|
| FL_PDBrowserFontSize
|
|
|
|
|
| FL_PDLabelFontSize
|
|
|
|
|
| FL_PDChoiceFontSize
|
|
|
|
|
| FL_PDInputFontSize
|
|
|
|
|
| FL_PDMenuFontSize
|
|
|
|
|
| FL_PDBorderWidth, &cntl);
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
extern "C" {
|
|
|
|
|
|
|
|
|
|
int LyX_XErrHandler(Display * display, XErrorEvent * xeev) {
|
|
|
|
|
// We don't abort on BadWindow
|
|
|
|
|
if (xeev->error_code == BadWindow) {
|
|
|
|
|
lyxerr << "BadWindow received !" << endl;
|
|
|
|
|
lyxerr << "If you're using xforms 1.0 or greater, "
|
|
|
|
|
<< " please report this to lyx-devel@lists.lyx.org" << endl;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// emergency cleanup
|
|
|
|
|
LyX::emergencyCleanup();
|
|
|
|
|
|
|
|
|
|
// Get the reason for the crash.
|
|
|
|
|
char etxt[513];
|
|
|
|
|
XGetErrorText(display, xeev->error_code, etxt, 512);
|
|
|
|
|
lyxerr << etxt << " id: " << xeev->resourceid << endl;
|
|
|
|
|
// By doing an abort we get a nice backtrace. (hopefully)
|
2003-06-30 23:56:22 +00:00
|
|
|
|
lyx::support::abort();
|
2002-06-12 09:47:10 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
}
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
/// read in geometry specification
|
|
|
|
|
char geometry[40];
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
} // namespace anon
|
|
|
|
|
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
namespace lyx_gui {
|
|
|
|
|
|
|
|
|
|
bool use_gui = true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void parse_init(int & argc, char * argv[])
|
2002-06-12 09:47:10 +00:00
|
|
|
|
{
|
|
|
|
|
setDefaults();
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
FL_CMD_OPT cmdopt[] = {
|
|
|
|
|
{"-geometry", "*.geometry", XrmoptionSepArg, "690x510"}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
FL_resource res[] = {
|
|
|
|
|
{"geometry", "geometryClass", FL_STRING, geometry, "", 40}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const int num_res = sizeof(res)/sizeof(FL_resource);
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
fl_initialize(&argc, argv, "LyX", cmdopt, num_res);
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
// It appears that, in xforms >=0.89.5, fl_initialize()
|
|
|
|
|
// calls setlocale() and ruins our LC_NUMERIC setting.
|
|
|
|
|
locale_init();
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
fl_get_app_resources(res, num_res);
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
Display * display = fl_get_display();
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
if (!display) {
|
|
|
|
|
lyxerr << "LyX: unable to access X display, exiting" << endl;
|
|
|
|
|
os::warn("Unable to access X display, exiting");
|
2002-06-12 14:50:27 +00:00
|
|
|
|
::exit(1);
|
2002-06-12 09:47:10 +00:00
|
|
|
|
}
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
fcntl(ConnectionNumber(display), F_SETFD, FD_CLOEXEC);
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
XSetErrorHandler(LyX_XErrHandler);
|
|
|
|
|
|
|
|
|
|
lyxColorHandler.reset(new LyXColorHandler());
|
2002-07-28 18:13:51 +00:00
|
|
|
|
|
2003-07-04 08:23:23 +00:00
|
|
|
|
using namespace lyx::graphics;
|
2002-07-12 16:26:25 +00:00
|
|
|
|
|
|
|
|
|
// connect the image loader based on the xforms library
|
|
|
|
|
Image::newImage = boost::bind(&xformsImage::newImage);
|
|
|
|
|
Image::loadableFormats = boost::bind(&xformsImage::loadableFormats);
|
2002-08-20 16:42:41 +00:00
|
|
|
|
|
2002-11-04 00:15:56 +00:00
|
|
|
|
// must do this /before/ lyxrc gets read
|
2002-08-20 16:42:41 +00:00
|
|
|
|
lyxrc.dpi = getDPI();
|
2003-02-25 11:20:59 +00:00
|
|
|
|
|
|
|
|
|
LoaderQueue::setPriority(10,100);
|
2002-06-12 09:47:10 +00:00
|
|
|
|
}
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
void parse_lyxrc()
|
2002-06-12 09:47:10 +00:00
|
|
|
|
{
|
2003-07-27 22:13:29 +00:00
|
|
|
|
XformsColor::read(AddName(user_lyxdir(), "preferences.xform"));
|
2002-06-12 09:47:10 +00:00
|
|
|
|
|
|
|
|
|
if (lyxrc.popup_font_encoding.empty())
|
|
|
|
|
lyxrc.popup_font_encoding = lyxrc.font_norm;
|
|
|
|
|
// Set the font name for popups and menus
|
|
|
|
|
string boldfontname = lyxrc.popup_bold_font
|
|
|
|
|
+ "-*-*-*-?-*-*-*-*-"
|
|
|
|
|
+ lyxrc.popup_font_encoding;
|
|
|
|
|
// "?" means "scale that font"
|
|
|
|
|
string fontname = lyxrc.popup_normal_font
|
|
|
|
|
+ "-*-*-*-?-*-*-*-*-"
|
|
|
|
|
+ lyxrc.popup_font_encoding;
|
|
|
|
|
|
|
|
|
|
int bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str());
|
|
|
|
|
int normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str());
|
|
|
|
|
if (bold < 0)
|
|
|
|
|
lyxerr << "Could not set menu font to "
|
|
|
|
|
<< boldfontname << endl;
|
|
|
|
|
|
|
|
|
|
if (normal < 0)
|
|
|
|
|
lyxerr << "Could not set popup font to "
|
|
|
|
|
<< fontname << endl;
|
|
|
|
|
|
|
|
|
|
if (bold < 0 && normal < 0) {
|
|
|
|
|
lyxerr << "Using 'helvetica' font for menus" << endl;
|
|
|
|
|
boldfontname = "-*-helvetica-bold-r-*-*-*-?-*-*-*-*-iso8859-1";
|
|
|
|
|
fontname = "-*-helvetica-medium-r-*-*-*-?-*-*-*-*-iso8859-1";
|
|
|
|
|
bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str());
|
|
|
|
|
normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str());
|
|
|
|
|
|
|
|
|
|
if (bold < 0 && normal < 0) {
|
|
|
|
|
lyxerr << "Could not find helvetica font. Using 'fixed'." << endl;
|
|
|
|
|
fl_set_font_name(FL_NORMAL_STYLE, "fixed");
|
|
|
|
|
normal = bold = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (bold < 0)
|
|
|
|
|
fl_set_font_name(FL_BOLD_STYLE, fontname.c_str());
|
|
|
|
|
else if (normal < 0)
|
|
|
|
|
fl_set_font_name(FL_NORMAL_STYLE, boldfontname.c_str());
|
|
|
|
|
|
|
|
|
|
fl_setpup_fontstyle(FL_NORMAL_STYLE);
|
|
|
|
|
fl_setpup_fontsize(FL_NORMAL_SIZE);
|
|
|
|
|
fl_setpup_color(FL_MCOL, FL_BLACK);
|
|
|
|
|
fl_set_goodies_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
|
|
|
|
|
fl_set_tooltip_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
void start(string const & batch, vector<string> const & files)
|
2002-06-12 09:47:10 +00:00
|
|
|
|
{
|
|
|
|
|
// initial geometry
|
|
|
|
|
int xpos = -1;
|
|
|
|
|
int ypos = -1;
|
|
|
|
|
unsigned int width = 690;
|
|
|
|
|
unsigned int height = 510;
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-11-04 00:15:56 +00:00
|
|
|
|
int const geometryBitmask =
|
2002-06-12 09:47:10 +00:00
|
|
|
|
XParseGeometry(geometry,
|
2002-11-04 02:12:42 +00:00
|
|
|
|
&xpos, &ypos, &width, &height);
|
2002-06-12 09:47:10 +00:00
|
|
|
|
|
|
|
|
|
// if width is not set by geometry, check it against monitor width
|
2002-11-04 00:15:56 +00:00
|
|
|
|
if (!(geometryBitmask & WidthValue)) {
|
2002-06-12 09:47:10 +00:00
|
|
|
|
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
|
|
|
|
|
if (WidthOfScreen(scr) - 8 < int(width))
|
|
|
|
|
width = WidthOfScreen(scr) - 8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// if height is not set by geometry, check it against monitor height
|
2002-11-04 00:15:56 +00:00
|
|
|
|
if (!(geometryBitmask & HeightValue)) {
|
2002-06-12 09:47:10 +00:00
|
|
|
|
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen);
|
|
|
|
|
if (HeightOfScreen(scr) - 24 < int(height))
|
|
|
|
|
height = HeightOfScreen(scr) - 24;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Screen * s = ScreenOfDisplay(fl_get_display(), fl_screen);
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
// recalculate xpos if it's not set
|
|
|
|
|
if (xpos == -1)
|
|
|
|
|
xpos = (WidthOfScreen(s) - width) / 2;
|
|
|
|
|
|
|
|
|
|
// recalculate ypos if it's not set
|
|
|
|
|
if (ypos == -1)
|
|
|
|
|
ypos = (HeightOfScreen(s) - height) / 2;
|
|
|
|
|
|
2002-11-27 10:30:28 +00:00
|
|
|
|
lyxerr[Debug::GUI] << "Creating view: " << width << 'x' << height
|
|
|
|
|
<< '+' << xpos << '+' << ypos << endl;
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
XFormsView view(width, height);
|
|
|
|
|
view.show(xpos, ypos, "LyX");
|
|
|
|
|
view.init();
|
|
|
|
|
|
|
|
|
|
// FIXME: some code below needs moving
|
|
|
|
|
|
2002-08-13 14:40:38 +00:00
|
|
|
|
lyxserver = new LyXServer(&view.getLyXFunc(), lyxrc.lyxpipes);
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
2002-06-12 09:47:10 +00:00
|
|
|
|
vector<string>::const_iterator cit = files.begin();
|
|
|
|
|
vector<string>::const_iterator end = files.end();
|
2003-06-27 07:11:31 +00:00
|
|
|
|
for (; cit != end; ++cit)
|
|
|
|
|
view.view()->loadLyXFile(*cit, true);
|
2002-06-12 09:47:10 +00:00
|
|
|
|
|
|
|
|
|
// handle the batch commands the user asked for
|
2003-07-29 16:40:26 +00:00
|
|
|
|
if (!batch.empty())
|
2002-08-13 14:40:38 +00:00
|
|
|
|
view.getLyXFunc().dispatch(batch);
|
2002-06-12 09:47:10 +00:00
|
|
|
|
|
2002-07-02 19:23:10 +00:00
|
|
|
|
// enter the event loop
|
2002-06-12 09:47:10 +00:00
|
|
|
|
while (!finished) {
|
|
|
|
|
if (fl_check_forms() == FL_EVENT) {
|
|
|
|
|
XEvent ev;
|
|
|
|
|
fl_XNextEvent(&ev);
|
2002-11-29 15:51:17 +00:00
|
|
|
|
lyxerr[Debug::GUI]
|
|
|
|
|
<< "Received unhandled X11 event" << endl
|
|
|
|
|
<< "Type: " << ev.xany.type
|
|
|
|
|
<< " Target: 0x" << hex << ev.xany.window
|
|
|
|
|
<< dec << endl;
|
2002-06-12 09:47:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-19 20:56:31 +00:00
|
|
|
|
// FIXME: breaks emergencyCleanup
|
2002-06-12 09:47:10 +00:00
|
|
|
|
delete lyxserver;
|
|
|
|
|
}
|
2002-07-02 19:23:10 +00:00
|
|
|
|
|
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
void exit()
|
2002-07-22 18:56:04 +00:00
|
|
|
|
{
|
|
|
|
|
finished = true;
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-28 18:13:51 +00:00
|
|
|
|
|
2003-06-03 19:32:08 +00:00
|
|
|
|
void sync_events()
|
|
|
|
|
{
|
|
|
|
|
// FIXME
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
FuncStatus getStatus(FuncRequest const & /*ev*/)
|
2002-12-18 14:24:32 +00:00
|
|
|
|
{
|
|
|
|
|
// Nothing interesting to do here
|
|
|
|
|
return FuncStatus();
|
|
|
|
|
}
|
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
string const hexname(LColor::color col)
|
2002-07-05 21:24:15 +00:00
|
|
|
|
{
|
2003-02-11 17:53:38 +00:00
|
|
|
|
unsigned int r, g, b;
|
|
|
|
|
bool const success = getRGBColor(col, r, g, b);
|
|
|
|
|
if (!success) {
|
|
|
|
|
lyxerr << "X can't find color for \"" << lcolor.getLyXName(col)
|
|
|
|
|
<< '"' << endl;
|
|
|
|
|
return string();
|
|
|
|
|
}
|
2002-07-05 21:24:15 +00:00
|
|
|
|
|
2003-02-11 17:53:38 +00:00
|
|
|
|
ostringstream os;
|
2002-07-05 21:24:15 +00:00
|
|
|
|
|
|
|
|
|
os << setbase(16) << setfill('0')
|
2003-02-11 17:53:38 +00:00
|
|
|
|
<< setw(2) << r
|
|
|
|
|
<< setw(2) << g
|
|
|
|
|
<< setw(2) << b;
|
2002-07-05 21:24:15 +00:00
|
|
|
|
|
2003-09-15 11:00:00 +00:00
|
|
|
|
return os.str();
|
2002-07-05 21:24:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-07-12 02:27:42 +00:00
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
void update_color(LColor::color col)
|
2002-07-12 02:27:42 +00:00
|
|
|
|
{
|
|
|
|
|
lyxColorHandler->updateColor(col);
|
|
|
|
|
}
|
2002-07-12 03:05:13 +00:00
|
|
|
|
|
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
void update_fonts()
|
2002-07-12 03:05:13 +00:00
|
|
|
|
{
|
|
|
|
|
fontloader.update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
bool font_available(LyXFont const & font)
|
2002-07-12 03:05:13 +00:00
|
|
|
|
{
|
|
|
|
|
return fontloader.available(font);
|
|
|
|
|
}
|
2002-07-14 01:44:15 +00:00
|
|
|
|
|
|
|
|
|
namespace {
|
2002-07-15 09:04:03 +00:00
|
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
|
void C_read_callback(int, void * data)
|
|
|
|
|
{
|
2002-07-28 18:13:51 +00:00
|
|
|
|
LyXComm * comm = static_cast<LyXComm *>(data);
|
2002-07-15 09:04:03 +00:00
|
|
|
|
comm->read_ready();
|
|
|
|
|
}
|
|
|
|
|
|
2002-07-14 01:44:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
void set_read_callback(int fd, LyXComm * comm)
|
2002-07-14 01:44:15 +00:00
|
|
|
|
{
|
|
|
|
|
fl_add_io_callback(fd, FL_READ, C_read_callback, comm);
|
|
|
|
|
}
|
2002-07-30 22:35:43 +00:00
|
|
|
|
|
|
|
|
|
|
2003-03-31 02:59:34 +00:00
|
|
|
|
void remove_read_callback(int fd)
|
2002-07-30 22:35:43 +00:00
|
|
|
|
{
|
|
|
|
|
fl_remove_io_callback(fd, FL_READ, C_read_callback);
|
|
|
|
|
}
|
2003-03-31 02:59:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string const roman_font_name()
|
|
|
|
|
{
|
|
|
|
|
return "times";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string const sans_font_name()
|
|
|
|
|
{
|
|
|
|
|
return "helvetica";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
string const typewriter_font_name()
|
|
|
|
|
{
|
|
|
|
|
return "courier";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}; // namespace lyx_gui
|