1999-09-27 18:44:28 +00:00
|
|
|
/* This file is part of
|
1999-10-02 16:21:10 +00:00
|
|
|
* ======================================================
|
|
|
|
*
|
|
|
|
* LyX, The Document Processor
|
|
|
|
*
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
2000-03-16 04:29:22 +00:00
|
|
|
* Copyright 1995-2000 The LyX Team.
|
1999-10-02 16:21:10 +00:00
|
|
|
*
|
1999-11-15 12:01:38 +00:00
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#include <config.h>
|
1999-10-02 16:21:10 +00:00
|
|
|
#include <cstdlib>
|
2001-01-24 11:08:32 +00:00
|
|
|
#include <clocale>
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include "lyx_gui.h"
|
2000-06-12 11:27:15 +00:00
|
|
|
#include FORMS_H_LOCATION
|
2000-07-19 10:22:12 +00:00
|
|
|
#include "support/filetools.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "combox.h"
|
|
|
|
#include "lyx.h"
|
|
|
|
#include "form1.h"
|
|
|
|
#include "layout_forms.h"
|
|
|
|
#include "print_form.h"
|
|
|
|
#include "tex-strings.h"
|
|
|
|
#include "lyx_main.h"
|
1999-10-07 18:44:17 +00:00
|
|
|
#include "debug.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "version.h"
|
|
|
|
#include "LyXView.h"
|
|
|
|
#include "buffer.h"
|
|
|
|
#include "lyxserver.h"
|
|
|
|
#include "lyxrc.h"
|
|
|
|
#include "gettext.h"
|
|
|
|
#include "lyx_gui_misc.h"
|
2000-12-05 17:12:47 +00:00
|
|
|
#if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "lyxlookup.h"
|
2000-11-02 04:48:34 +00:00
|
|
|
#endif
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "bufferlist.h"
|
2000-03-10 13:22:20 +00:00
|
|
|
#include "language.h"
|
2000-04-16 22:27:30 +00:00
|
|
|
#include "ColorHandler.h"
|
2000-08-16 15:27:11 +00:00
|
|
|
#include "frontends/GUIRunTime.h"
|
2000-11-15 18:02:45 +00:00
|
|
|
#include "frontends/xforms/xform_helpers.h" // for XformColor
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-03-28 02:18:55 +00:00
|
|
|
using std::endl;
|
|
|
|
|
1999-12-21 06:10:21 +00:00
|
|
|
FD_form_title * fd_form_title;
|
|
|
|
FD_form_character * fd_form_character;
|
|
|
|
FD_form_preamble * fd_form_preamble;
|
|
|
|
FD_form_sendto * fd_form_sendto;
|
|
|
|
FD_form_figure * fd_form_figure;
|
|
|
|
Combox * combo_language;
|
2000-04-17 14:00:18 +00:00
|
|
|
Combox * combo_language2;
|
1999-12-21 06:10:21 +00:00
|
|
|
|
|
|
|
extern LyXServer * lyxserver;
|
1999-09-27 18:44:28 +00:00
|
|
|
extern bool finished; // flag, that we are quitting the program
|
|
|
|
extern BufferList bufferlist;
|
2000-09-11 15:30:21 +00:00
|
|
|
extern GUIRunTime guiruntime;
|
2000-11-13 10:35:02 +00:00
|
|
|
extern string user_lyxdir;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
FL_CMD_OPT cmdopt[] =
|
|
|
|
{
|
2000-07-04 20:32:37 +00:00
|
|
|
{"-geometry", "*.geometry", XrmoptionSepArg, "690x510"}
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2000-07-04 20:32:37 +00:00
|
|
|
static int width = 690;
|
|
|
|
static int height = 510;
|
|
|
|
static int xpos = -1;
|
|
|
|
static int ypos = -1;
|
|
|
|
static char geometry[40];
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
|
FL_resource res[] =
|
|
|
|
{
|
2000-07-05 20:16:38 +00:00
|
|
|
{"geometry", "geometryClass", FL_STRING, geometry, "", 40}
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-08-16 23:48:48 +00:00
|
|
|
extern "C"
|
|
|
|
int LyX_XErrHandler(Display * display, XErrorEvent * xeev)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
// emergency save
|
1999-11-05 06:02:34 +00:00
|
|
|
if (!bufferlist.empty())
|
1999-09-27 18:44:28 +00:00
|
|
|
bufferlist.emergencyWriteAll();
|
|
|
|
|
|
|
|
// Get the reason for the crash.
|
|
|
|
char etxt[513];
|
|
|
|
XGetErrorText(display, xeev->error_code, etxt, 512);
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << etxt << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
// By doing an abort we get a nice backtrace. (hopefully)
|
2000-01-17 21:01:30 +00:00
|
|
|
lyx::abort();
|
1999-09-27 18:44:28 +00:00
|
|
|
return 0; // Solaris CC wants us to return something
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-21 06:10:21 +00:00
|
|
|
LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
|
2000-08-24 23:10:28 +00:00
|
|
|
: _owner(owner), lyxViews(0)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
gui = GUI;
|
|
|
|
if (!gui)
|
|
|
|
return;
|
|
|
|
|
2000-09-18 19:41:52 +00:00
|
|
|
//
|
1999-09-27 18:44:28 +00:00
|
|
|
setDefaults();
|
|
|
|
|
|
|
|
static const int num_res = sizeof(res)/sizeof(FL_resource);
|
|
|
|
fl_initialize(argc, argv, "LyX", cmdopt, num_res);
|
2001-01-24 11:08:32 +00:00
|
|
|
// It appears that, in xforms >=0.89.5, fl_initialize()
|
|
|
|
// calls setlocale() and ruins our LC_NUMERIC setting.
|
|
|
|
setlocale(LC_NUMERIC, "C");
|
|
|
|
fl_get_app_resources(res, num_res);
|
2000-01-21 19:26:42 +00:00
|
|
|
|
2000-08-24 23:10:28 +00:00
|
|
|
static const int geometryBitmask =
|
|
|
|
XParseGeometry( geometry,
|
|
|
|
&xpos,
|
|
|
|
&ypos,
|
|
|
|
reinterpret_cast<unsigned int *>(&width),
|
|
|
|
reinterpret_cast<unsigned int *>(&height));
|
2000-07-04 20:32:37 +00:00
|
|
|
|
1999-11-22 16:19:48 +00:00
|
|
|
Display * display = fl_get_display();
|
1999-09-27 18:44:28 +00:00
|
|
|
if (!display) {
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "LyX: unable to access X display, exiting" << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
fcntl(ConnectionNumber(display), F_SETFD, FD_CLOEXEC);
|
|
|
|
// X Error handler install goes here
|
|
|
|
XSetErrorHandler(LyX_XErrHandler);
|
2000-07-05 20:16:38 +00:00
|
|
|
|
|
|
|
// A width less than 590 pops up an awkward main window
|
2000-07-17 13:41:20 +00:00
|
|
|
// The minimal values of width/height (590/400) are defined in
|
|
|
|
// src/lyx.C
|
|
|
|
if (width < 590) width = 590;
|
|
|
|
if (height < 400) height = 400;
|
|
|
|
|
2000-07-05 20:16:38 +00:00
|
|
|
// If width is not set by geometry, check it against monitor width
|
2000-11-04 10:00:12 +00:00
|
|
|
if (!(geometryBitmask & 4)) {
|
2000-10-11 21:06:43 +00:00
|
|
|
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen); //DefaultScreen(fl_get_display());
|
1999-12-13 00:05:34 +00:00
|
|
|
if (WidthOfScreen(scr) - 8 < width)
|
|
|
|
width = WidthOfScreen(scr) - 8;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
2000-07-05 20:16:38 +00:00
|
|
|
// If height is not set by geometry, check it against monitor height
|
2000-11-04 10:00:12 +00:00
|
|
|
if (!(geometryBitmask & 8)) {
|
2000-10-11 21:06:43 +00:00
|
|
|
Screen * scr = ScreenOfDisplay(fl_get_display(), fl_screen); //DefaultScreen(fl_get_display());
|
2000-07-05 20:16:38 +00:00
|
|
|
if (HeightOfScreen(scr) - 24 < height)
|
|
|
|
height = HeightOfScreen(scr) - 24;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Recalculate xpos if it's negative
|
|
|
|
if (geometryBitmask & 16)
|
2000-10-11 21:06:43 +00:00
|
|
|
xpos += WidthOfScreen(ScreenOfDisplay(fl_get_display(), fl_screen)) - width; //DefaultScreen(fl_get_display())) - width;
|
2000-07-05 20:16:38 +00:00
|
|
|
|
|
|
|
// Recalculate ypos if it's negative
|
|
|
|
if (geometryBitmask & 32)
|
2000-10-11 21:06:43 +00:00
|
|
|
ypos += HeightOfScreen(ScreenOfDisplay(fl_get_display(), fl_screen)) - height; //DefaultScreen(fl_get_display())) - height;
|
2000-07-05 20:16:38 +00:00
|
|
|
|
2000-04-16 22:27:30 +00:00
|
|
|
// Initialize the LyXColorHandler
|
|
|
|
lyxColorHandler = new LyXColorHandler;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// A destructor is always necessary (asierra-970604)
|
1999-12-21 06:10:21 +00:00
|
|
|
LyXGUI::~LyXGUI()
|
|
|
|
{
|
1999-09-27 18:44:28 +00:00
|
|
|
// Lyxserver was created in this class so should be destroyed
|
|
|
|
// here. asierra-970604
|
2000-02-04 09:38:32 +00:00
|
|
|
delete lyxserver;
|
|
|
|
lyxserver = 0;
|
2000-04-17 14:00:18 +00:00
|
|
|
delete lyxViews;
|
2000-12-05 17:12:47 +00:00
|
|
|
#if FL_REVISION < 89 || (FL_REVISION == 89 && FL_FIXLEVEL < 5)
|
1999-09-27 18:44:28 +00:00
|
|
|
CloseLyXLookup();
|
2000-11-02 04:48:34 +00:00
|
|
|
#endif
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LyXGUI::setDefaults()
|
|
|
|
{
|
2000-09-18 19:41:52 +00:00
|
|
|
GUIRunTime::setDefaults();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// This is called after we have parsed lyxrc
|
|
|
|
void LyXGUI::init()
|
|
|
|
{
|
|
|
|
if (!gui)
|
|
|
|
return;
|
|
|
|
|
|
|
|
create_forms();
|
2000-03-10 13:22:20 +00:00
|
|
|
|
2000-03-12 10:35:05 +00:00
|
|
|
if (lyxrc.font_norm_menu.empty())
|
|
|
|
lyxrc.font_norm_menu = lyxrc.font_norm;
|
1999-09-27 18:44:28 +00:00
|
|
|
// Set the font name for popups and menus
|
2000-10-16 13:27:56 +00:00
|
|
|
string boldfontname = lyxrc.menu_font_name
|
1999-09-27 18:44:28 +00:00
|
|
|
+ "-*-*-*-?-*-*-*-*-"
|
2000-03-12 10:35:05 +00:00
|
|
|
+ lyxrc.font_norm_menu;
|
1999-09-27 18:44:28 +00:00
|
|
|
// "?" means "scale that font"
|
2000-10-16 13:27:56 +00:00
|
|
|
string fontname = lyxrc.popup_font_name
|
1999-09-27 18:44:28 +00:00
|
|
|
+ "-*-*-*-?-*-*-*-*-"
|
2000-03-12 10:35:05 +00:00
|
|
|
+ lyxrc.font_norm_menu;
|
2000-02-04 09:38:32 +00:00
|
|
|
|
2000-10-16 13:27:56 +00:00
|
|
|
int bold = fl_set_font_name(FL_BOLD_STYLE, boldfontname.c_str());
|
|
|
|
int normal = fl_set_font_name(FL_NORMAL_STYLE, fontname.c_str());
|
2000-05-22 16:56:05 +00:00
|
|
|
if (bold < 0)
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "Could not set menu font to "
|
2000-10-16 13:27:56 +00:00
|
|
|
<< boldfontname << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-05-22 16:56:05 +00:00
|
|
|
if (normal < 0)
|
1999-10-07 18:44:17 +00:00
|
|
|
lyxerr << "Could not set popup font to "
|
2000-10-16 13:27:56 +00:00
|
|
|
<< fontname << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-05-22 16:56:05 +00:00
|
|
|
if (bold < 0 && normal < 0) {
|
|
|
|
lyxerr << "Using 'helvetica' font for menus" << endl;
|
2000-10-16 13:27:56 +00:00
|
|
|
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());
|
|
|
|
|
2000-05-22 16:56:05 +00:00
|
|
|
if (bold < 0 && normal < 0) {
|
|
|
|
lyxerr << "Could not find helvetica font. Using 'fixed'." << endl;
|
2000-10-16 13:27:56 +00:00
|
|
|
fl_set_font_name(FL_NORMAL_STYLE, "fixed");
|
|
|
|
normal = bold = 0;
|
2000-05-22 16:56:05 +00:00
|
|
|
}
|
|
|
|
}
|
2000-10-16 13:27:56 +00:00
|
|
|
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());
|
2000-05-22 16:56:05 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
// put here (after fl_initialize) to avoid segfault. Cannot be done
|
|
|
|
// in setDefaults() (Matthias 140496)
|
|
|
|
// Moved from ::LyXGUI to ::init to allow popup font customization
|
|
|
|
// (petr 120997).
|
|
|
|
fl_setpup_fontstyle(FL_NORMAL_STYLE);
|
|
|
|
fl_setpup_fontsize(FL_NORMAL_SIZE);
|
1999-11-15 12:01:38 +00:00
|
|
|
fl_setpup_color(FL_MCOL, FL_BLACK);
|
1999-09-27 18:44:28 +00:00
|
|
|
fl_set_goodies_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
|
|
|
|
|
|
|
|
// all lyxrc settings has to be done here as lyxrc has not yet
|
|
|
|
// been read when the GUI is created (Jug)
|
|
|
|
|
|
|
|
// the sendto form
|
2000-03-12 10:35:05 +00:00
|
|
|
if (!lyxrc.custom_export_command.empty())
|
1999-09-27 18:44:28 +00:00
|
|
|
fl_set_input(fd_form_sendto->input_cmd,
|
2000-03-12 10:35:05 +00:00
|
|
|
lyxrc.custom_export_command.c_str());
|
|
|
|
if (lyxrc.custom_export_format == "lyx")
|
1999-09-27 18:44:28 +00:00
|
|
|
fl_set_button(fd_form_sendto->radio_ftype_lyx, 1);
|
2000-03-12 10:35:05 +00:00
|
|
|
else if (lyxrc.custom_export_format == "tex")
|
1999-09-27 18:44:28 +00:00
|
|
|
fl_set_button(fd_form_sendto->radio_ftype_latex, 1);
|
2000-03-12 10:35:05 +00:00
|
|
|
else if (lyxrc.custom_export_format == "dvi")
|
1999-09-27 18:44:28 +00:00
|
|
|
fl_set_button(fd_form_sendto->radio_ftype_dvi, 1);
|
2000-03-12 10:35:05 +00:00
|
|
|
else if (lyxrc.custom_export_format == "ps")
|
1999-09-27 18:44:28 +00:00
|
|
|
fl_set_button(fd_form_sendto->radio_ftype_ps, 1);
|
2000-03-12 10:35:05 +00:00
|
|
|
else if (lyxrc.custom_export_format == "ascii")
|
1999-09-27 18:44:28 +00:00
|
|
|
fl_set_button(fd_form_sendto->radio_ftype_ascii, 1);
|
|
|
|
|
|
|
|
// Update parameters.
|
|
|
|
lyxViews->redraw();
|
|
|
|
|
|
|
|
// Initialize the views.
|
|
|
|
lyxViews->init();
|
|
|
|
|
|
|
|
// in 0.12 the initialisation of the LyXServer must be done here
|
|
|
|
// 0.13 it should be moved again...
|
2000-03-12 10:35:05 +00:00
|
|
|
lyxserver = new LyXServer(lyxViews->getLyXFunc(), lyxrc.lyxpipes);
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LyXGUI::create_forms()
|
|
|
|
{
|
1999-11-09 23:52:04 +00:00
|
|
|
lyxerr[Debug::INIT] << "Initializing LyXView..." << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
lyxViews = new LyXView(width, height);
|
1999-11-09 23:52:04 +00:00
|
|
|
lyxerr[Debug::INIT] << "Initializing LyXView...done" << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// From here down should be done by somebody else. (Lgb)
|
|
|
|
|
|
|
|
//
|
|
|
|
// Create forms
|
|
|
|
//
|
|
|
|
|
|
|
|
// the title form
|
2000-07-19 10:22:12 +00:00
|
|
|
string banner_file = LibFileSearch("images", "banner", "xpm");
|
|
|
|
if (lyxrc.show_banner && !banner_file.empty()) {
|
2000-03-06 02:42:40 +00:00
|
|
|
fd_form_title = create_form_form_title();
|
|
|
|
fl_set_form_dblbuffer(fd_form_title->form_title, 1); // use dbl buffer
|
|
|
|
fl_set_form_atclose(fd_form_title->form_title, CancelCloseBoxCB, 0);
|
|
|
|
fl_addto_form(fd_form_title->form_title);
|
|
|
|
FL_OBJECT *obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, "");
|
2000-07-19 10:22:12 +00:00
|
|
|
fl_set_pixmapbutton_file(obj, banner_file.c_str());
|
2000-03-06 02:42:40 +00:00
|
|
|
|
|
|
|
fl_set_pixmapbutton_focus_outline(obj, 3);
|
|
|
|
fl_set_button_shortcut(obj, "^M ^[", 1);
|
|
|
|
fl_set_object_boxtype(obj, FL_NO_BOX);
|
|
|
|
fl_set_object_callback(obj, TimerCB, 0);
|
|
|
|
|
|
|
|
obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16, LYX_VERSION);
|
|
|
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
|
|
fl_mapcolor(FL_FREE_COL2, 0x05, 0x2e, 0x4c);
|
|
|
|
fl_mapcolor(FL_FREE_COL3, 0xe1, 0xd2, 0x9b);
|
|
|
|
fl_set_object_color(obj, FL_FREE_COL2, FL_FREE_COL2);
|
|
|
|
fl_set_object_lcol(obj, FL_FREE_COL3);
|
|
|
|
fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
|
|
|
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
|
|
|
fl_end_form();
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// the character form
|
|
|
|
fd_form_character = create_form_form_character();
|
|
|
|
fl_set_form_atclose(fd_form_character->form_character,
|
1999-10-02 16:21:10 +00:00
|
|
|
CancelCloseBoxCB, 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
fl_addto_choice(fd_form_character->choice_family,
|
|
|
|
_(" No change %l| Roman | Sans Serif | Typewriter %l| Reset "));
|
|
|
|
fl_addto_choice(fd_form_character->choice_series,
|
|
|
|
_(" No change %l| Medium | Bold %l| Reset "));
|
|
|
|
fl_addto_choice(fd_form_character->choice_shape,
|
|
|
|
_(" No change %l| Upright | Italic | Slanted | Small Caps "
|
|
|
|
"%l| Reset "));
|
|
|
|
fl_addto_choice(fd_form_character->choice_size,
|
|
|
|
_(" No change %l| Tiny | Smallest | Smaller | Small "
|
|
|
|
"| Normal | Large | Larger | Largest | Huge | Huger "
|
|
|
|
"%l| Increase | Decrease | Reset "));
|
|
|
|
fl_addto_choice(fd_form_character->choice_bar,
|
|
|
|
_(" No change %l| Emph | Underbar | Noun | LaTeX mode %l| Reset "));
|
|
|
|
fl_addto_choice(fd_form_character->choice_color,
|
|
|
|
_(" No change %l| No color | Black | White | Red | Green "
|
|
|
|
"| Blue | Cyan | Magenta | Yellow %l| Reset "));
|
2000-10-16 13:27:56 +00:00
|
|
|
// Appears to need initialising to avoid seg fault when dialog is
|
|
|
|
// launched. Over-written by combo_language2, below
|
|
|
|
fl_addto_choice(fd_form_character->choice_language,
|
|
|
|
_(" English %l| German | French "));
|
1999-10-25 14:50:26 +00:00
|
|
|
fl_set_form_minsize(fd_form_character->form_character,
|
|
|
|
fd_form_character->form_character->w,
|
|
|
|
fd_form_character->form_character->h);
|
2000-06-12 11:27:15 +00:00
|
|
|
lyxerr[Debug::INIT] << "Initializing form_character::combox..." << endl;
|
2000-04-17 14:00:18 +00:00
|
|
|
fl_addto_form(fd_form_character->form_character);
|
|
|
|
combo_language2 = new Combox(FL_COMBOX_DROPLIST);
|
|
|
|
FL_OBJECT * ob = fd_form_character->choice_language;
|
|
|
|
combo_language2->add(ob->x, ob->y, ob->w, ob->h, 250);
|
|
|
|
combo_language2->shortcut("#L", 1);
|
|
|
|
fl_end_form();
|
2000-06-12 11:27:15 +00:00
|
|
|
lyxerr[Debug::INIT] << "Initializing form_character...done" << endl;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-08-31 05:01:52 +00:00
|
|
|
// build up the combox entries
|
2000-10-13 12:20:38 +00:00
|
|
|
combo_language2->addline(_("No change"));
|
|
|
|
combo_language2->addline(_("Reset"));
|
2000-11-04 10:00:12 +00:00
|
|
|
for (Languages::const_iterator cit = languages.begin();
|
2000-08-31 05:01:52 +00:00
|
|
|
cit != languages.end(); ++cit) {
|
2000-09-27 15:23:24 +00:00
|
|
|
#ifdef DO_USE_DEFAULT_LANGUAGE
|
2000-09-08 11:15:01 +00:00
|
|
|
if ((*cit).second.lang() != "default")
|
2000-09-27 15:23:24 +00:00
|
|
|
#endif
|
2000-10-11 21:06:43 +00:00
|
|
|
combo_language2->addto((*cit).second.lang());
|
2000-08-31 05:01:52 +00:00
|
|
|
}
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
// the preamble form
|
|
|
|
fd_form_preamble = create_form_form_preamble();
|
|
|
|
fl_set_form_atclose(fd_form_preamble->form_preamble,
|
1999-10-02 16:21:10 +00:00
|
|
|
CancelCloseBoxCB, 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// the sendto form
|
|
|
|
fd_form_sendto = create_form_form_sendto();
|
1999-11-15 12:01:38 +00:00
|
|
|
fl_set_form_atclose(fd_form_sendto->form_sendto, CancelCloseBoxCB, 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// the figure form
|
|
|
|
fd_form_figure = create_form_form_figure();
|
|
|
|
fl_set_form_atclose(fd_form_figure->form_figure,
|
1999-10-02 16:21:10 +00:00
|
|
|
CancelCloseBoxCB, 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
fl_set_button(fd_form_figure->radio_postscript, 1);
|
|
|
|
|
2000-11-13 10:35:02 +00:00
|
|
|
// This is probably as good a time as any to map the xform colours,
|
|
|
|
// should a mapping exist.
|
|
|
|
{
|
2000-11-15 18:02:45 +00:00
|
|
|
string filename = AddName(user_lyxdir, "preferences.xform");
|
2000-11-13 10:35:02 +00:00
|
|
|
XformColor::read( filename );
|
|
|
|
}
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
// Show the main & title form
|
|
|
|
int main_placement = FL_PLACE_CENTER | FL_FREE_SIZE;
|
|
|
|
int title_placement = FL_PLACE_CENTER;
|
|
|
|
// Did we get a valid position?
|
2000-08-16 23:48:48 +00:00
|
|
|
if (xpos >= 0 && ypos >= 0) {
|
1999-09-27 18:44:28 +00:00
|
|
|
lyxViews->setPosition(xpos, ypos);
|
2000-03-12 10:35:05 +00:00
|
|
|
if (lyxrc.show_banner) {
|
2000-03-06 02:42:40 +00:00
|
|
|
// show the title form in the middle of the main form
|
|
|
|
fl_set_form_position(fd_form_title->form_title,
|
|
|
|
abs(xpos + (width/2) - (370 / 2)),
|
|
|
|
abs(ypos + (height/2) - (290 / 2)));
|
|
|
|
title_placement = FL_PLACE_GEOMETRY;
|
|
|
|
// The use of abs() above is a trick to ensure
|
|
|
|
// valid positions
|
|
|
|
}
|
|
|
|
main_placement = FL_PLACE_POSITION;
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
lyxViews->show(main_placement, FL_FULLBORDER, "LyX");
|
2000-03-12 10:35:05 +00:00
|
|
|
if (lyxrc.show_banner) {
|
2000-03-06 02:42:40 +00:00
|
|
|
fl_show_form(fd_form_title->form_title,
|
|
|
|
title_placement, FL_NOBORDER,
|
|
|
|
_("LyX Banner"));
|
|
|
|
fl_redraw_form(fd_form_title->form_title);
|
|
|
|
fl_raise_form(fd_form_title->form_title);
|
|
|
|
|
|
|
|
// Show the title form at most 7 secs (lowered from 10 secs)
|
|
|
|
fl_set_timer(fd_form_title->timer_title, 7);
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void LyXGUI::runTime()
|
|
|
|
{
|
2000-08-16 23:48:48 +00:00
|
|
|
if (!gui) return;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-09-11 15:30:21 +00:00
|
|
|
guiruntime.runTime();
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-21 06:10:21 +00:00
|
|
|
void LyXGUI::regBuf(Buffer * b)
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
1999-11-22 16:19:48 +00:00
|
|
|
lyxViews->view()->buffer(b);
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
2000-04-28 11:18:04 +00:00
|
|
|
|
2000-08-16 23:48:48 +00:00
|
|
|
|
2000-04-28 11:18:04 +00:00
|
|
|
LyXView * LyXGUI::getLyXView() const
|
|
|
|
{
|
|
|
|
return lyxViews;
|
|
|
|
}
|