src_frontends_qt3_header_files = Split('''
BulletsModule.h
FileDialog_private.h
+ GuiApplication.h
GuiClipboard.h
GuiImplementation.h
GuiSelection.h
Dialogs.C
FileDialog.C
FileDialog_private.C
+ GuiApplication.C
GuiClipboard.C
GuiSelection.C
LyXKeySymFactory.C
--- /dev/null
+/**
+ * \file qt3/GuiApplication.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author unknown
+ * \author John Levon
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#include <config.h>
+
+#include "frontends/LyXView.h"
+#include "frontends/WorkArea.h"
+
+#include "GuiApplication.h"
+
+#include "QtView.h"
+#include "GuiWorkArea.h"
+#include "qt_helpers.h"
+#include "QLImage.h"
+
+#include "BufferView.h"
+
+#include "graphics/LoaderQueue.h"
+
+#include "support/lstrings.h"
+#include "support/os.h"
+#include "support/package.h"
+
+#include "lyx_main.h"
+#include "lyxrc.h"
+#include "debug.h"
+
+#include <qapplication.h>
+#include <qclipboard.h>
+#include <qeventloop.h>
+#include <qlocale.h>
+#include <qpaintdevicemetrics.h>
+#include <qtextcodec.h>
+#include <qtranslator.h>
+
+#ifdef Q_WS_X11
+#include <X11/Xlib.h>
+#endif
+
+#include <boost/bind.hpp>
+
+using lyx::support::subst;
+
+using std::string;
+using std::endl;
+
+// in QLyXKeySym.C
+extern void initEncodings();
+
+///////////////////////////////////////////////////////////////
+// You can find other X11 and MACX specific stuff
+// at the end of this file...
+///////////////////////////////////////////////////////////////
+
+namespace {
+
+int getDPI()
+{
+ QWidget w;
+ QPaintDeviceMetrics pdm(&w);
+ return int(0.5 * (pdm.logicalDpiX() + pdm.logicalDpiY()));
+}
+
+} // namespace anon
+
+
+namespace lyx {
+namespace frontend {
+
+GuiApplication::GuiApplication(int & argc, char ** argv)
+ : QApplication(argc, argv), Application(argc, argv)
+{
+#ifdef Q_WS_X11
+ // doubleClickInterval() is 400 ms on X11 witch is just too long.
+ // On Windows and Mac OS X, the operating system's value is used.
+ // On Microsoft Windows, calling this function sets the double
+ // click interval for all applications. So we don't!
+ QApplication::setDoubleClickInterval(300);
+#endif
+
+#ifdef Q_WS_MACX
+ AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
+ NewAEEventHandlerUPP(handleOpenDocuments),
+ 0, false);
+#endif
+
+#if QT_VERSION >= 0x030200
+ // install translation file for Qt built-in dialogs
+ // These are only installed since Qt 3.2.x
+ QTranslator qt_trans(0);
+ if (qt_trans.load(QString("qt_") + QTextCodec::locale(),
+ qInstallPathTranslations())) {
+ qApp->installTranslator(&qt_trans);
+ // even if the language calls for RtL, don't do that
+ qApp->setReverseLayout(false);
+ lyxerr[Debug::GUI]
+ << "Successfully installed Qt translations for locale "
+ << QTextCodec::locale() << std::endl;
+ } else
+ lyxerr[Debug::GUI]
+ << "Could not find Qt translations for locale "
+ << QTextCodec::locale() << std::endl;
+#endif
+
+#ifdef Q_WS_MACX
+ // These translations are meant to break Qt/Mac menu merging
+ // algorithm on some entries. It lists the menu names that
+ // should not be moved to the LyX menu
+ QTranslator aqua_trans(0);
+ aqua_trans.insert(QTranslatorMessage("QMenuBar", "Setting", 0,
+ "do_not_merge_me"));
+ aqua_trans.insert(QTranslatorMessage("QMenuBar", "Config", 0,
+ "do_not_merge_me"));
+ aqua_trans.insert(QTranslatorMessage("QMenuBar", "Options", 0,
+ "do_not_merge_me"));
+ aqua_trans.insert(QTranslatorMessage("QMenuBar", "Setup", 0,
+ "do_not_merge_me"));
+
+ qApp->installTranslator(&aqua_trans);
+#endif
+
+ using namespace lyx::graphics;
+
+ Image::newImage = boost::bind(&QLImage::newImage);
+ Image::loadableFormats = boost::bind(&QLImage::loadableFormats);
+
+ // needs to be done before reading lyxrc
+ lyxrc.dpi = getDPI();
+
+ LoaderQueue::setPriority(10,100);
+}
+
+
+Clipboard& GuiApplication::clipboard()
+{
+ return clipboard_;
+}
+
+
+Selection& GuiApplication::selection()
+{
+ return selection_;
+}
+
+
+int const GuiApplication::exec()
+{
+ return QApplication::exec();
+}
+
+
+void GuiApplication::exit(int status)
+{
+ QApplication::exit(status);
+}
+
+
+// FIXME: this whole method needs to be moved to Application.
+LyXView & GuiApplication::createView(unsigned int width,
+ unsigned int height,
+ int posx, int posy,
+ bool maximize)
+{
+ // this can't be done before because it needs the Languages object
+ initEncodings();
+
+ int view_id = gui().newView(width, height);
+ QtView & view = static_cast<QtView &> (gui().view(view_id));
+
+ lyxfunc_.reset(new LyXFunc(&view));
+
+ // FIXME: for now we assume that there is only one LyXView with id = 0.
+ /*int workArea_id_ =*/ gui().newWorkArea(width, height, 0);
+ //WorkArea * workArea_ = & theApp->gui().workArea(workArea_id_);
+
+ LyX::ref().addLyXView(&view);
+
+ view.init();
+
+ // FIXME: put this initialisation code in GuiView accessible via
+ // a pure virtual method in LyXView.
+
+ // only true when the -geometry option was NOT used
+ if (width != 0 && height != 0) {
+ view.initFloatingGeometry(QRect(posx, posy, width, height));
+ view.resize(width, height);
+ if (posx != -1 && posy != -1)
+ view.move(posx, posy);
+ view.show();
+ if (maximize)
+ view.setWindowState(Qt::WindowMaximized);
+ } else
+ view.show();
+
+ return view;
+}
+
+
+////////////////////////////////////////////////////////////////////////
+// X11 specific stuff goes here...
+#ifdef Q_WS_X11
+bool GuiApplication::x11EventFilter(XEvent * xev)
+{
+ switch (xev->type) {
+ case SelectionRequest:
+ lyxerr[Debug::GUI] << "X requested selection." << endl;
+ if (buffer_view_) {
+ lyx::docstring const sel = buffer_view_->requestSelection();
+ if (!sel.empty())
+ selection_.put(sel);
+ }
+ break;
+ case SelectionClear:
+ lyxerr[Debug::GUI] << "Lost selection." << endl;
+ if (buffer_view_)
+ buffer_view_->clearSelection();
+ break;
+ }
+ return false;
+}
+#endif
+
+
+////////////////////////////////////////////////////////////////////////
+// Mac OSX specific stuff goes here...
+
+#ifdef Q_WS_MACX
+namespace{
+
+OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent)
+ {
+ DescType returnedType;
+ Size actualSize;
+ OSErr err = AEGetAttributePtr(&theAppleEvent, keyMissedKeywordAttr,
+ typeWildCard, &returnedType, nil, 0,
+ &actualSize);
+ switch (err) {
+ case errAEDescNotFound:
+ return noErr;
+ case noErr:
+ return errAEEventNotHandled;
+ default:
+ return err;
+ }
+ }
+
+} // namespace
+
+OSErr GuiApplication::handleOpenDocuments(const AppleEvent* inEvent,
+ AppleEvent* /*reply*/, long /*refCon*/)
+{
+ QString s_arg;
+ AEDescList documentList;
+ OSErr err = AEGetParamDesc(inEvent, keyDirectObject, typeAEList,
+ &documentList);
+ if (err != noErr)
+ return err;
+
+ err = checkAppleEventForMissingParams(*inEvent);
+ if (err == noErr) {
+ long documentCount;
+ err = AECountItems(&documentList, &documentCount);
+ for (long documentIndex = 1;
+ err == noErr && documentIndex <= documentCount;
+ documentIndex++) {
+ DescType returnedType;
+ Size actualSize;
+ AEKeyword keyword;
+ FSRef ref;
+ char qstr_buf[1024];
+ err = AESizeOfNthItem(&documentList, documentIndex,
+ &returnedType, &actualSize);
+ if (err == noErr) {
+ err = AEGetNthPtr(&documentList, documentIndex,
+ typeFSRef, &keyword,
+ &returnedType, (Ptr)&ref,
+ sizeof(FSRef), &actualSize);
+ if (err == noErr) {
+ FSRefMakePath(&ref, (UInt8*)qstr_buf,
+ 1024);
+ s_arg=QString::fromUtf8(qstr_buf);
+// buffer_view_->workAreaDispatch(
+// FuncRequest(LFUN_FILE_OPEN,
+// fromqstr(s_arg)));
+ break;
+ }
+ }
+ } // for ...
+ }
+ AEDisposeDesc(&documentList);
+
+ return err;
+}
+
+bool GuiApplication::macEventFilter(EventRef event)
+{
+ if (GetEventClass(event) == kEventClassAppleEvent) {
+ EventRecord eventrec;
+ ConvertEventRefToEventRecord(event, &eventrec);
+ AEProcessAppleEvent(&eventrec);
+
+ return false;
+ }
+ return false;
+}
+
+#endif // Q_WS_MACX
+
+} // namespace frontend
+} // namespace lyx
--- /dev/null
+/**
+ * \file qt3/GuiApplication.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * \author unknown
+ * \author John Levon
+ * \author Abdelrazak Younes
+ *
+ * Full author contact details are available in file CREDITS.
+ */
+
+#ifndef QT3_APPLICATION_H
+#define QT3_APPLICATION_H
+
+#include "frontends/Application.h"
+
+#include "qfont_loader.h"
+#include "GuiClipboard.h"
+#include "GuiImplementation.h"
+#include "GuiSelection.h"
+
+#include <qapplication.h>
+
+///////////////////////////////////////////////////////////////
+// Specific stuff
+
+#ifdef Q_WS_MACX
+#include <Carbon/Carbon.h>
+#endif
+///////////////////////////////////////////////////////////////
+
+class BufferView;
+
+namespace lyx {
+namespace frontend {
+
+class GuiWorkArea;
+
+/// The Qt main application class
+/**
+There should be only one instance of this class. No Qt object
+initialisation should be done before the instanciation of this class.
+
+\todo The work areas handling could be moved to a base virtual class
+comon to all frontends.
+*/
+class GuiApplication : public QApplication, public Application
+{
+public:
+ GuiApplication(int & argc, char ** argv);
+
+ /// Method inherited from \c Application class
+ //@{
+ virtual Clipboard& clipboard();
+ virtual Selection& selection();
+ virtual int const exec();
+ virtual Gui & gui() { return gui_; }
+ virtual void exit(int status);
+ //@}
+
+ ///
+ FontLoader & fontLoader() { return font_loader_; }
+
+ ///
+ LyXView & createView(unsigned int width, unsigned int height,
+ int posx, int posy, bool maximize);
+
+private:
+ ///
+ GuiImplementation gui_;
+ ///
+ GuiClipboard clipboard_;
+ ///
+ GuiSelection selection_;
+ ///
+ FontLoader font_loader_;
+
+#ifdef Q_WS_X11
+public:
+ bool x11EventFilter (XEvent * ev);
+#endif
+
+#ifdef Q_WS_MACX
+public:
+ bool macEventFilter(EventRef event);
+private:
+// static OSStatus handleOpenDocuments(
+ static pascal OSErr handleOpenDocuments(
+ const AppleEvent* inEvent, AppleEvent*, long);
+#endif
+}; // GuiApplication
+
+} // namespace frontend
+} // namespace lyx
+
+extern lyx::frontend::GuiApplication * guiApp;
+
+
+#endif // QT3_APPLICATION_H
#include "qscreen.h"
#include "QWorkArea.h"
-#include "GuiClipboard.h"
-#include "GuiSelection.h"
#include "GuiWorkArea.h"
#include "BufferView.h"
{
}
- lyx::frontend::Clipboard& clipboard()
- {
- return clipboard_;
- }
-
- lyx::frontend::Selection& selection()
- {
- return *selection_;
- }
-
int newView(unsigned int /*w*/, unsigned int /*h*/)
{
- view_.reset(new FView(*this));
+ view_.reset(new FView);
return 0;
}
old_work_area_.reset(new FWorkArea(*view_.get(), w, h));
old_screen_.reset(new FScreen(*old_work_area_.get()));
work_area_.reset(new GuiWorkArea(old_screen_.get(), old_work_area_.get()));
- selection_.reset(new GuiSelection(old_work_area_.get()));
// FIXME BufferView creation should be independant of WorkArea creation
buffer_views_[0].reset(new BufferView(view_.get()));
void destroyWorkArea(int /*id*/)
{
- selection_.reset();
work_area_.reset();
old_work_area_.reset();
old_screen_.reset();
}
private:
- ///
- GuiClipboard clipboard_;
- ///
- boost::shared_ptr<GuiSelection> selection_;
///
boost::shared_ptr<GuiWorkArea> work_area_;
///
QClipboard::Selection);
}
+
+void GuiSelection::haveSelection(bool own)
+{
+ if (!QApplication::clipboard()->supportsSelection())
+ return;
+
+ if (own)
+ QApplication::clipboard()->setText(QString(), QClipboard::Selection);
+ // We don't need to do anything if own = false, as this case is
+ // handled by QT.
+}
+
} // namespace frontend
} // namespace lyx
#include "frontends/Selection.h"
-#include "QWorkArea.h"
-
namespace lyx {
namespace frontend {
class GuiSelection: public lyx::frontend::Selection
{
public:
- GuiSelection(QWorkArea * work_area)
- : old_work_area_(work_area)
- {
- }
+ GuiSelection() {}
virtual ~GuiSelection() {}
/** Selection overloaded methods
*/
//@{
- void haveSelection(bool own)
- {
- old_work_area_->haveSelection(own);
- }
+ void haveSelection(bool);
docstring const get() const;
void put(docstring const & str);
//@}
-
-private:
- QWorkArea * old_work_area_;
};
} // namespace frontend
Alert_pimpl.C \
Dialogs.C \
FileDialog.C \
+ GuiApplication.C GuiApplication.h \
GuiClipboard.C GuiClipboard.h \
GuiImplementation.h \
GuiSelection.C GuiSelection.h \
namespace os = lyx::support::os;
-namespace {
-lyx::frontend::QWorkArea * wa_ptr = 0;
-}
-
namespace lyx {
namespace frontend {
vl->addWidget(content_, 5);
vl->addWidget(scrollbar_, 0);
-#ifdef Q_WS_MACX
- wa_ptr = this;
-#endif
show();
}
scrollbar_->setTracking(true);
}
-} // namespace frontend
-} // namespace lyx
-
-
-#ifdef Q_WS_X11
-bool lyxX11EventFilter(XEvent * xev)
-{
- switch (xev->type) {
- case SelectionRequest:
- lyxerr[Debug::GUI] << "X requested selection." << endl;
- if (wa_ptr) {
- lyx::docstring const sel = wa_ptr->view().view()->requestSelection();
- if (!sel.empty())
- wa_ptr->view().gui().selection().put(sel);
- }
- break;
- case SelectionClear:
- lyxerr[Debug::GUI] << "Lost selection." << endl;
- if (wa_ptr)
- wa_ptr->view().view()->clearSelection();
- break;
- }
- return false;
-}
-#endif
-
-#ifdef Q_WS_MACX
-namespace{
-OSErr checkAppleEventForMissingParams(const AppleEvent& theAppleEvent)
- {
- DescType returnedType;
- Size actualSize;
- OSErr err = AEGetAttributePtr(&theAppleEvent, keyMissedKeywordAttr,
- typeWildCard, &returnedType, nil, 0,
- &actualSize);
- switch (err) {
- case errAEDescNotFound:
- return noErr;
- case noErr:
- return errAEEventNotHandled;
- default:
- return err;
- }
- }
-}
-
-pascal OSErr handleOpenDocuments(const AppleEvent* inEvent,
- AppleEvent* /*reply*/, long /*refCon*/)
-{
- QString s_arg;
- AEDescList documentList;
- OSErr err = AEGetParamDesc(inEvent, keyDirectObject, typeAEList,
- &documentList);
- if (err != noErr)
- return err;
-
- err = checkAppleEventForMissingParams(*inEvent);
- if (err == noErr) {
- long documentCount;
- err = AECountItems(&documentList, &documentCount);
- for (long documentIndex = 1;
- err == noErr && documentIndex <= documentCount;
- documentIndex++) {
- DescType returnedType;
- Size actualSize;
- AEKeyword keyword;
- FSRef ref;
- char qstr_buf[1024];
- err = AESizeOfNthItem(&documentList, documentIndex,
- &returnedType, &actualSize);
- if (err == noErr) {
- err = AEGetNthPtr(&documentList, documentIndex,
- typeFSRef, &keyword,
- &returnedType, (Ptr)&ref,
- sizeof(FSRef), &actualSize);
- if (err == noErr) {
- FSRefMakePath(&ref, (UInt8*)qstr_buf,
- 1024);
- s_arg=QString::fromUtf8(qstr_buf);
- wa_ptr->view().view()->workAreaDispatch(
- FuncRequest(LFUN_FILE_OPEN,
- fromqstr(s_arg)));
- break;
- }
- }
- } // for ...
- }
- AEDisposeDesc(&documentList);
- return err;
-}
-#endif // Q_WS_MACX
-
-
-namespace lyx {
-namespace frontend {
-
-void QWorkArea::haveSelection(bool own)
-{
- wa_ptr = const_cast<QWorkArea*>(this);
-
- if (!QApplication::clipboard()->supportsSelection())
- return;
-
- if (own) {
- QApplication::clipboard()->setSelectionMode(true);
- QApplication::clipboard()->setText(QString());
- }
- // We don't need to do anything if own = false, as this case is
- // handled by QT.
-}
-
void QWorkArea::dragEnterEvent(QDragEnterEvent * event)
{
///
virtual void setScrollbarParams(int height, int pos, int line_height);
- /// a selection exists
- virtual void haveSelection(bool);
///
virtual void dragEnterEvent(QDragEnterEvent * event);
///
} // namespace anon
-QtView::QtView(Gui & owner)
- : QMainWindow(), LyXView(owner), commandbuffer_(0)
+QtView::QtView()
+ : QMainWindow(), LyXView(), commandbuffer_(0)
{
qApp->setMainWidget(this);
Q_OBJECT
public:
/// create a main window of the given dimensions
- QtView(Gui & owner);
+ QtView();
~QtView();
#include "lyx_gui.h"
// FIXME: move this stuff out again
-#include "bufferlist.h"
#include "BufferView.h"
#include "Color.h"
#include "funcrequest.h"
#include "lyxserver.h"
#include "lyxsocket.h"
-#include "graphics/LoaderQueue.h"
-
#include "support/lstrings.h"
#include "support/os.h"
#include "support/package.h"
#include <boost/signal.hpp> // FIXME: Is this needed? (Lgb)
#include <boost/bind.hpp>
#include <boost/shared_ptr.hpp>
+#include "frontends/LyXView.h"
#include "frontends/WorkArea.h"
-#include "GuiImplementation.h"
+#include "GuiApplication.h"
#include "QtView.h"
#include "lcolorcache.h"
#include "qfont_loader.h"
using lyx::support::ltrim;
using lyx::support::package;
-using lyx::frontend::Gui;
-using lyx::frontend::GuiImplementation;
+using lyx::frontend::GuiApplication;
using lyx::frontend::QtView;
namespace os = lyx::support::os;
using std::string;
-extern BufferList bufferlist;
-
-// FIXME: wrong place !
-LyXServer * lyxserver;
-LyXServerSocket * lyxsocket;
-
namespace {
-int getDPI()
-{
- QWidget w;
- QPaintDeviceMetrics pdm(&w);
- return int(0.5 * (pdm.logicalDpiX() + pdm.logicalDpiY()));
-}
-
map<int, shared_ptr<socket_callback> > socket_callbacks;
-void cleanup()
-{
- delete lyxsocket;
- lyxsocket = 0;
- delete lyxserver;
- lyxserver = 0;
-}
-
} // namespace anon
-// in QLyXKeySym.C
-extern void initEncodings();
-
-#ifdef Q_WS_X11
-extern bool lyxX11EventFilter(XEvent * xev);
-#endif
-
-#ifdef Q_WS_MACX
-extern pascal OSErr
-handleOpenDocuments(const AppleEvent* inEvent, AppleEvent* /*reply*/,
- long /*refCon*/);
-#endif
-
-class LQApplication : public QApplication
-{
-public:
- LQApplication(int & argc, char ** argv);
- //
- Gui & gui() { return gui_; }
-
-#ifdef Q_WS_X11
- bool x11EventFilter (XEvent * ev) { return lyxX11EventFilter(ev); }
-#endif
-#ifdef Q_WS_MACX
- bool macEventFilter(EventRef event);
-#endif
-
-private:
- ///
- GuiImplementation gui_;
-};
-
-
-LQApplication::LQApplication(int & argc, char ** argv)
- : QApplication(argc, argv)
-{
-#ifdef Q_WS_MACX
- AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
- NewAEEventHandlerUPP(handleOpenDocuments),
- 0, false);
-#endif
-}
-
-#ifdef Q_WS_MACX
-bool LQApplication::macEventFilter(EventRef event)
-{
- if (GetEventClass(event) == kEventClassAppleEvent) {
- EventRecord eventrec;
- ConvertEventRefToEventRecord(event, &eventrec);
- AEProcessAppleEvent(&eventrec);
-
- return false;
- }
- return false;
-}
-#endif
-
-LQApplication * theApp;
+lyx::frontend::Application * theApp;
+GuiApplication * guiApp;
namespace lyx_gui {
// Force adding of font path _before_ QApplication is initialized
FontLoader::initFontPath();
- LQApplication app(argc, argv);
- theApp = &app;
-
-#if QT_VERSION >= 0x030200
- // install translation file for Qt built-in dialogs
- // These are only installed since Qt 3.2.x
- QTranslator qt_trans(0);
- if (qt_trans.load(QString("qt_") + QTextCodec::locale(),
- qInstallPathTranslations())) {
- qApp->installTranslator(&qt_trans);
- // even if the language calls for RtL, don't do that
- qApp->setReverseLayout(false);
- lyxerr[Debug::GUI]
- << "Successfully installed Qt translations for locale "
- << QTextCodec::locale() << std::endl;
- } else
- lyxerr[Debug::GUI]
- << "Could not find Qt translations for locale "
- << QTextCodec::locale() << std::endl;
-#endif
-
-#ifdef Q_WS_MACX
- // These translations are meant to break Qt/Mac menu merging
- // algorithm on some entries. It lists the menu names that
- // should not be moved to the LyX menu
- QTranslator aqua_trans(0);
- aqua_trans.insert(QTranslatorMessage("QMenuBar", "Setting", 0,
- "do_not_merge_me"));
- aqua_trans.insert(QTranslatorMessage("QMenuBar", "Config", 0,
- "do_not_merge_me"));
- aqua_trans.insert(QTranslatorMessage("QMenuBar", "Options", 0,
- "do_not_merge_me"));
- aqua_trans.insert(QTranslatorMessage("QMenuBar", "Setup", 0,
- "do_not_merge_me"));
-
- qApp->installTranslator(&aqua_trans);
-#endif
-
- using namespace lyx::graphics;
-
- Image::newImage = boost::bind(&QLImage::newImage);
- Image::loadableFormats = boost::bind(&QLImage::loadableFormats);
+ GuiApplication app(argc, argv);
- // needs to be done before reading lyxrc
- lyxrc.dpi = getDPI();
-
- LoaderQueue::setPriority(10,100);
+ guiApp = &app;
+ theApp = guiApp;
return LyX::ref().exec2(argc, argv);
}
LyXView* create_view(unsigned int width, unsigned int height, int posx, int posy,
bool maximize)
{
- // this can't be done before because it needs the Languages object
- initEncodings();
-
- int view_id = theApp->gui().newView(width, height);
- QtView & view = static_cast<QtView &> (theApp->gui().view(view_id));
- theApp->gui().newWorkArea(width, height, 0);
-
- LyX::ref().addLyXView(&view);
-
- view.init();
-
- if (width != 0 && height != 0) {
- view.initFloatingGeometry(QRect(posx, posy, width, height));
- view.resize(width, height);
- if (posx != -1 && posy != -1)
- view.move(posx, posy);
- view.show();
- if (maximize)
- view.setWindowState(Qt::WindowMaximized);
- } else
- view.show();
-
- return &view;
+ return &guiApp->createView(width, height, posx, posy, maximize);
}
-int start(LyXView * view, string const & batch)
+int start(LyXView *, string const & batch)
{
- // FIXME: some code below needs moving
-
- lyxserver = new LyXServer(&view->getLyXFunc(), lyxrc.lyxpipes);
- lyxsocket = new LyXServerSocket(&view->getLyXFunc(),
- os::internal_path(package().temp_dir() + "/lyxsocket"));
-
- // handle the batch commands the user asked for
- if (!batch.empty()) {
- view->getLyXFunc().dispatch(lyxaction.lookupFunc(batch));
- }
-
- int const status = qApp->exec();
-
- // FIXME
- cleanup();
- return status;
+ return theApp->start(batch);
}
void exit(int status)
{
- cleanup();
- QApplication::exit(status);
+ guiApp->exit(status);
}