main.C now GUII.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1008 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2000-09-11 15:30:21 +00:00
parent a826cf25b5
commit 21f8cd3385
7 changed files with 147 additions and 57 deletions

View File

@ -1,5 +1,14 @@
2000-09-11 Juergen Vigna <jug@sad.it>
* src/lyx_gui.C (runTime): uses global guiruntime variable.
* src/main.C (main): now GUII defines global guiruntime!
* src/frontends/gnome/GUIRunTime.C (initApplication):
* src/frontends/kde/GUIRunTime.C (initApplication):
* src/frontends/xforms/GUIRunTime.C (initApplication):
* src/frontends/GUIRunTime.h: added new function initApplication.
* src/spellchecker.C (sc_accept_word): change to add_to_session.
* src/vspace.C (nextToken): fixed error with number 0cm as unvalid.

View File

@ -23,6 +23,8 @@ class LyXView;
*/
class GUIRunTime {
public:
static
int initApplication(int argc, char * argv[]);
///
static
void processEvents();

View File

@ -19,11 +19,59 @@
#include "debug.h"
#include <gnome--/main.h>
#include "mainapp.h"
using std::endl;
// I keep these here so that it will be processed as early in
// the compilation process as possible.
#if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0
#error LyX will not compile with this version of XForms.\
Please get version 0.89.\
If you want to try to compile anyway, delete this test in src/frontends/gnome/GUIRunTime.C.
#endif
extern bool finished;
static int const xforms_include_version = FL_INCLUDE_VERSION;
GLyxAppWin * mainAppWin;
int GUIRunTime::initApplication(int, char * argv[])
{
// Check the XForms version in the forms.h header against
// the one in the libforms. If they don't match quit the
// execution of LyX. Better with a clean fast exit than
// a strange segfault later.
// I realize that this check have to be moved when we
// support several toolkits, but IMO all the toolkits
// should try to have the same kind of check. This could
// be done by having a CheckHeaderAndLib function in
// all the toolkit implementations, this function is
// responsible for notifing the user.
// if (!CheckHeaderAndLib()) {
// // header vs. lib version failed
// return 1;
// }
int xforms_lib_version = fl_library_version(0, 0);
if (xforms_include_version != xforms_lib_version) {
cerr << "You are either running LyX with wrong "
"version of a dynamic XForms library\n"
"or you have build LyX with conflicting header "
"and library (different\n"
"versions of XForms. Sorry but there is no point "
"in continuing executing LyX!" << endl;
return 1;
}
string app_id(PACKAGE);
string app_version(VERSION);
static Gnome::Main a(app_id, app_version, 1, argv);
static GLyxAppWin appWin;
mainAppWin = &appWin;
return 0;
}
void GUIRunTime::processEvents()
{
while(Gnome::Main::instance()->events_pending())

View File

@ -22,8 +22,51 @@
using std::endl;
// For now we need this here as long as we use xforms components!
// I keep these here so that it will be processed as early in
// the compilation process as possible.
#if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0
#error LyX will not compile with this version of XForms.\
Please get version 0.89.\
If you want to try to compile anyway, delete this test in src/frontends/kde/GUIRunTime.C.
#endif
extern bool finished;
static int const xforms_include_version = FL_INCLUDE_VERSION;
int GUIRunTime::initApplication(int argc, char * argv[])
{
// Check the XForms version in the forms.h header against
// the one in the libforms. If they don't match quit the
// execution of LyX. Better with a clean fast exit than
// a strange segfault later.
// I realize that this check have to be moved when we
// support several toolkits, but IMO all the toolkits
// should try to have the same kind of check. This could
// be done by having a CheckHeaderAndLib function in
// all the toolkit implementations, this function is
// responsible for notifing the user.
// if (!CheckHeaderAndLib()) {
// // header vs. lib version failed
// return 1;
// }
int xforms_lib_version = fl_library_version(0, 0);
if (xforms_include_version != xforms_lib_version) {
cerr << "You are either running LyX with wrong "
"version of a dynamic XForms library\n"
"or you have build LyX with conflicting header "
"and library (different\n"
"versions of XForms. Sorry but there is no point "
"in continuing executing LyX!" << endl;
return 1;
}
static KApplication a(argc, argv);
return 0;
}
void GUIRunTime::processEvents()
{

View File

@ -17,10 +17,48 @@
#include "GUIRunTime.h"
#include "debug.h"
// I keep these here so that it will be processed as early in
// the compilation process as possible.
#if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0
#error LyX will not compile with this version of XForms.\
Please get version 0.89.\
If you want to try to compile anyway, delete this test in src/frontends/xforms/GUIRunTime.C.
#endif
using std::endl;
extern bool finished;
static int const xforms_include_version = FL_INCLUDE_VERSION;
int GUIRunTime::initApplication(int argc, char * argv[])
{
// Check the XForms version in the forms.h header against
// the one in the libforms. If they don't match quit the
// execution of LyX. Better with a clean fast exit than
// a strange segfault later.
// I realize that this check have to be moved when we
// support several toolkits, but IMO all the toolkits
// should try to have the same kind of check. This could
// be done by having a CheckHeaderAndLib function in
// all the toolkit implementations, this function is
// responsible for notifing the user.
// if (!CheckHeaderAndLib()) {
// // header vs. lib version failed
// return 1;
// }
int xforms_lib_version = fl_library_version(0, 0);
if (xforms_include_version != xforms_lib_version) {
cerr << "You are either running LyX with wrong "
"version of a dynamic XForms library\n"
"or you have build LyX with conflicting header "
"and library (different\n"
"versions of XForms. Sorry but there is no point "
"in continuing executing LyX!" << endl;
return 1;
}
return 0;
}
void GUIRunTime::processEvents()
{

View File

@ -63,6 +63,7 @@ Combox * combo_language2;
extern LyXServer * lyxserver;
extern bool finished; // flag, that we are quitting the program
extern BufferList bufferlist;
extern GUIRunTime guiruntime;
FL_CMD_OPT cmdopt[] =
{
@ -570,7 +571,7 @@ void LyXGUI::runTime()
{
if (!gui) return;
GUIRunTime::runTime();
guiruntime.runTime();
}

View File

@ -11,74 +11,23 @@
#include <config.h>
#include <iostream>
#ifdef KDEGUI
# include <kapp.h>
#endif
#ifdef GTKGUI
# include <gnome--/main.h>
# include "frontends/gnome/mainapp.h"
GLyxAppWin * mainAppWin;
#endif
#include FORMS_H_LOCATION
#include "lyx_main.h"
#include "gettext.h"
#include "LString.h"
#include "support/filetools.h"
// I keep these here so that it will be processed as early in
// the compilation process as possible.
#if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0
#error LyX will not compile with this version of XForms.\
Please get version 0.89.\
If you want to try to compile anyway, delete this test in src/main.C.
#endif
#include "frontends/GUIRunTime.h"
using std::cerr;
using std::endl;
static int const xforms_include_version = FL_INCLUDE_VERSION;
GUIRunTime guiruntime;
int main(int argc, char * argv[])
{
// Check the XForms version in the forms.h header against
// the one in the libforms. If they don't match quit the
// execution of LyX. Better with a clean fast exit than
// a strange segfault later.
// I realize that this check have to be moved when we
// support several toolkits, but IMO all the toolkits
// should try to have the same kind of check. This could
// be done by having a CheckHeaderAndLib function in
// all the toolkit implementations, this function is
// responsible for notifing the user.
// if (!CheckHeaderAndLib()) {
// // header vs. lib version failed
// return 1;
// }
int xforms_lib_version = fl_library_version(0, 0);
if (xforms_include_version != xforms_lib_version) {
cerr << "You are either running LyX with wrong "
"version of a dynamic XForms library\n"
"or you have build LyX with conflicting header "
"and library (different\n"
"versions of XForms. Sorry but there is no point "
"in continuing executing LyX!" << endl;
return 1;
}
int val = guiruntime.initApplication(argc, argv);
if (val)
return val;
#ifdef KDEGUI
KApplication a( argc, argv );
#endif
#ifdef GTKGUI
string app_id(PACKAGE);
string app_version(VERSION);
Gnome::Main a(app_id, app_version, 1, argv); //argc, argv );
GLyxAppWin appWin;
mainAppWin = &appWin;
#endif
// lyx_localedir is used by gettext_init() is we have
// i18n support built-in
string lyx_localedir = GetEnvPath("LYX_LOCALEDIR");