]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiApplication.cpp
* comment
[lyx.git] / src / frontends / qt4 / GuiApplication.cpp
1 /**
2  * \file GuiApplication.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author unknown
7  * \author John Levon
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 #include "GuiApplication.h"
16
17 #include "qt_helpers.h"
18 #include "GuiImage.h"
19 #include "GuiKeySymbol.h"
20 #include "GuiView.h"
21
22 #include "frontends/alert.h"
23 #include "frontends/Application.h"
24 #include "frontends/FontLoader.h"
25 #include "frontends/FontMetrics.h"
26
27 #include "Buffer.h"
28 #include "BufferList.h"
29 #include "BufferView.h"
30 #include "Font.h"
31 #include "FuncRequest.h"
32 #include "FuncStatus.h"
33 #include "LyX.h"
34 #include "LyXFunc.h"
35 #include "LyXRC.h"
36 #include "Session.h"
37 #include "version.h"
38
39 #include "support/debug.h"
40 #include "support/ExceptionMessage.h"
41 #include "support/FileName.h"
42 #include "support/ForkedCalls.h"
43 #include "support/gettext.h"
44 #include "support/lstrings.h"
45 #include "support/os.h"
46 #include "support/Package.h"
47
48 #include <QApplication>
49 #include <QClipboard>
50 #include <QEventLoop>
51 #include <QFileOpenEvent>
52 #include <QLocale>
53 #include <QLibraryInfo>
54 #include <QMenuBar>
55 #include <QPixmapCache>
56 #include <QRegExp>
57 #include <QSessionManager>
58 #include <QSocketNotifier>
59 #include <QTextCodec>
60 #include <QTimer>
61 #include <QTranslator>
62 #include <QWidget>
63
64 #ifdef Q_WS_X11
65 #include <X11/Xatom.h>
66 #include <X11/Xlib.h>
67 #undef CursorShape
68 #undef None
69 #endif
70
71 #include <boost/bind.hpp>
72
73 #include <exception>
74
75 using namespace std;
76 using namespace lyx::support;
77
78 namespace lyx {
79
80 frontend::Application * createApplication(int & argc, char * argv[])
81 {
82         return new frontend::GuiApplication(argc, argv);
83 }
84
85
86 namespace frontend {
87
88 class SocketNotifier : public QSocketNotifier
89 {
90 public:
91         /// connect a connection notification from the LyXServerSocket
92         SocketNotifier(QObject * parent, int fd, Application::SocketCallback func)
93                 : QSocketNotifier(fd, QSocketNotifier::Read, parent), func_(func)
94         {}
95
96 public:
97         /// The callback function
98         Application::SocketCallback func_;
99 };
100
101
102 ////////////////////////////////////////////////////////////////////////
103 // Mac specific stuff goes here...
104
105 class MenuTranslator : public QTranslator
106 {
107 public:
108         MenuTranslator(QObject * parent)
109                 : QTranslator(parent)
110         {}
111
112         QString translate(const char * /*context*/, 
113           const char * sourceText, 
114           const char * /*comment*/ = 0) 
115         {
116                 string const s = sourceText;
117                 if (s == N_("About %1") || s == N_("Preferences") 
118                                 || s == N_("Reconfigure") || s == N_("Quit %1"))
119                         return qt_(s);
120                 else 
121                         return QString();
122         }
123 };
124
125 class GlobalMenuBar : public QMenuBar
126 {
127 public:
128         ///
129         GlobalMenuBar() : QMenuBar(0) {}
130         
131         ///
132         bool event(QEvent * e)
133         {
134                 if (e->type() == QEvent::ShortcutOverride) {
135                         //          && activeWindow() == 0) {
136                         QKeyEvent * ke = static_cast<QKeyEvent*>(e);
137                         KeySymbol sym;
138                         setKeySymbol(&sym, ke);
139                         theLyXFunc().processKeySym(sym, q_key_state(ke->modifiers()));
140                         e->accept();
141                         return true;
142                 }
143                 return false;
144         }
145 };
146
147 ///////////////////////////////////////////////////////////////
148 // You can find more platform specific stuff
149 // at the end of this file...
150 ///////////////////////////////////////////////////////////////
151
152
153 GuiApplication * guiApp;
154
155
156 GuiApplication::GuiApplication(int & argc, char ** argv)
157         : QApplication(argc, argv), Application(), current_view_(0), global_menubar_(0)
158 {
159         QString app_name = "LyX";
160         QCoreApplication::setOrganizationName(app_name);
161         QCoreApplication::setOrganizationDomain("lyx.org");
162         QCoreApplication::setApplicationName(app_name + "-" + lyx_version);
163
164         // FIXME: quitOnLastWindowClosed is true by default. We should have a
165         // lyxrc setting for this in order to let the application stay resident.
166         // But then we need some kind of dock icon, at least on Windows.
167         /*
168         if (lyxrc.quit_on_last_window_closed)
169                 setQuitOnLastWindowClosed(false);
170         */
171 #ifdef Q_WS_MAC
172         // FIXME: Do we need a lyxrc setting for this on Mac? This behaviour
173         // seems to be the default case for applications like LyX.
174         setQuitOnLastWindowClosed(false);
175 #endif
176         
177 #ifdef Q_WS_X11
178         // doubleClickInterval() is 400 ms on X11 which is just too long.
179         // On Windows and Mac OS X, the operating system's value is used.
180         // On Microsoft Windows, calling this function sets the double
181         // click interval for all applications. So we don't!
182         QApplication::setDoubleClickInterval(300);
183 #endif
184
185         // install translation file for Qt built-in dialogs
186         QString language_name = QString("qt_") + QLocale::system().name();
187         
188         // language_name can be short (e.g. qt_zh) or long (e.g. qt_zh_CN). 
189         // Short-named translator can be loaded from a long name, but not the
190         // opposite. Therefore, long name should be used without truncation.
191         // c.f. http://doc.trolltech.com/4.1/qtranslator.html#load
192         if (qt_trans_.load(language_name,
193                 QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
194         {
195                 installTranslator(&qt_trans_);
196                 // even if the language calls for RtL, don't do that
197                 setLayoutDirection(Qt::LeftToRight);
198                 LYXERR(Debug::GUI, "Successfully installed Qt translations for locale "
199                         << fromqstr(language_name));
200         } else
201                 LYXERR(Debug::GUI, "Could not find  Qt translations for locale "
202                         << fromqstr(language_name));
203
204 #ifdef Q_WS_MACX
205         // This allows to translate the strings that appear in the LyX menu.
206         addMenuTranslator();
207 #endif
208         connect(this, SIGNAL(lastWindowClosed()), this, SLOT(onLastWindowClosed()));
209
210         using namespace lyx::graphics;
211
212         Image::newImage = boost::bind(&GuiImage::newImage);
213         Image::loadableFormats = boost::bind(&GuiImage::loadableFormats);
214
215         // needs to be done before reading lyxrc
216         QWidget w;
217         lyxrc.dpi = (w.logicalDpiX() + w.logicalDpiY()) / 2;
218
219         guiApp = this;
220
221         // Set the cache to 5120 kilobytes which corresponds to screen size of
222         // 1280 by 1024 pixels with a color depth of 32 bits.
223         QPixmapCache::setCacheLimit(5120);
224
225         // Initialize RC Fonts
226         if (lyxrc.roman_font_name.empty())
227                 lyxrc.roman_font_name = fromqstr(romanFontName());
228
229         if (lyxrc.sans_font_name.empty())
230                 lyxrc.sans_font_name = fromqstr(sansFontName());
231
232         if (lyxrc.typewriter_font_name.empty())
233                 lyxrc.typewriter_font_name = fromqstr(typewriterFontName());
234
235         general_timer_.setInterval(500);
236         connect(&general_timer_, SIGNAL(timeout()),
237                 this, SLOT(handleRegularEvents()));
238         general_timer_.start();
239         
240 #ifdef Q_WS_MACX
241         if (global_menubar_ == 0) {
242                 // Create the global default menubar which is shown for the dialogs
243                 // and if no GuiView is visible.
244                 global_menubar_ = new GlobalMenuBar();
245         }
246 #endif  
247 }
248
249
250 GuiApplication::~GuiApplication()
251 {
252         socket_notifiers_.clear();
253 }
254
255
256 FuncStatus GuiApplication::getStatus(FuncRequest const & cmd)
257 {
258         FuncStatus flag;
259         bool enable = true;
260
261         switch(cmd.action) {
262
263         case LFUN_WINDOW_CLOSE:
264                 enable = view_ids_.size() > 0;
265                 break;
266
267         default:
268                 if (!current_view_) {
269                         enable = false;
270                         break;
271                 }
272         }
273
274         if (!enable)
275                 flag.enabled(false);
276
277         return flag;
278 }
279
280         
281 bool GuiApplication::dispatch(FuncRequest const & cmd)
282 {
283         switch(cmd.action) {
284
285         case LFUN_WINDOW_NEW:
286                 createView(toqstr(cmd.argument()));
287                 break;
288
289         case LFUN_WINDOW_CLOSE:
290                 // update bookmark pit of the current buffer before window close
291                 for (size_t i = 0; i < LyX::ref().session().bookmarks().size(); ++i)
292                         theLyXFunc().gotoBookmark(i+1, false, false);
293                 current_view_->close();
294                 break;
295
296         case LFUN_LYX_QUIT:
297                 // quitting is triggered by the gui code
298                 // (leaving the event loop).
299                 current_view_->message(from_utf8(N_("Exiting.")));
300                 if (closeAllViews())
301                         quit();
302                 break;
303
304         case LFUN_SCREEN_FONT_UPDATE: {
305                 // handle the screen font changes.
306                 font_loader_.update();
307                 // Backup current_view_
308                 GuiView * view = current_view_;
309                 // Set current_view_ to zero to forbid GuiWorkArea::redraw()
310                 // to skip the refresh.
311                 current_view_ = 0;
312                 BufferList::iterator it = theBufferList().begin();
313                 BufferList::iterator const end = theBufferList().end();
314                 for (; it != end; ++it)
315                         (*it)->changed();
316                 // Restore current_view_
317                 current_view_ = view;
318                 break;
319         }
320
321         case LFUN_BUFFER_NEW:
322                 if (viewCount() == 0
323                     || (!lyxrc.open_buffers_in_tabs && current_view_->buffer() != 0))
324                         createView();
325                 current_view_->newDocument(to_utf8(cmd.argument()), false);
326                 break;
327
328         case LFUN_BUFFER_NEW_TEMPLATE:
329                 if (viewCount() == 0 
330                     || (!lyxrc.open_buffers_in_tabs && current_view_->buffer() != 0)) {
331                         createView();
332                         current_view_->newDocument(to_utf8(cmd.argument()), true);
333                         if (!current_view_->buffer())
334                                 current_view_->close();
335                 } else
336                         current_view_->newDocument(to_utf8(cmd.argument()), true);
337                 break;
338
339         case LFUN_FILE_OPEN:
340                 if (viewCount() == 0
341                     || (!lyxrc.open_buffers_in_tabs && current_view_->buffer() != 0)) {
342                         createView();
343                         current_view_->openDocument(to_utf8(cmd.argument()));
344                         if (!current_view_->buffer())
345                                 current_view_->close();
346                 } else
347                         current_view_->openDocument(to_utf8(cmd.argument()));
348                 break;
349
350         default:
351                 // Notify the caller that the action has not been dispatched.
352                 return false;
353         }
354
355         // The action has been dispatched.
356         return true;
357 }
358
359
360 void GuiApplication::resetGui()
361 {
362         map<int, GuiView *>::iterator it;
363         for (it = views_.begin(); it != views_.end(); ++it)
364                 it->second->resetDialogs();
365
366         dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
367 }
368
369
370 static void updateIds(map<int, GuiView *> const & stdmap, vector<int> & ids)
371 {
372         ids.clear();
373         map<int, GuiView *>::const_iterator it;
374         for (it = stdmap.begin(); it != stdmap.end(); ++it)
375                 ids.push_back(it->first);
376 }
377
378
379 void GuiApplication::createView(QString const & geometry_arg)
380 {
381         if (global_menubar_)
382                 global_menubar_->releaseKeyboard();
383
384         // create new view
385         updateIds(views_, view_ids_);
386         int id = 0;
387         while (views_.find(id) != views_.end())
388                 id++;
389         GuiView * view = new GuiView(id);
390         
391         // copy the icon size from old view
392         if (viewCount() > 0)
393                 view->setIconSize(current_view_->iconSize());
394
395         // register view
396         views_[id] = view;
397         updateIds(views_, view_ids_);
398
399         view->show();
400         if (!geometry_arg.isEmpty()) {
401 #ifdef Q_WS_WIN
402                 int x, y;
403                 int w, h;
404                 QRegExp re( "[=]*(?:([0-9]+)[xX]([0-9]+)){0,1}[ ]*(?:([+-][0-9]*)([+-][0-9]*)){0,1}" );
405                 re.indexIn(geometry_arg);
406                 w = re.cap(1).toInt();
407                 h = re.cap(2).toInt();
408                 x = re.cap(3).toInt();
409                 y = re.cap(4).toInt();
410                 view->setGeometry(x, y, w, h);
411 #endif
412         }
413         view->setFocus();
414         setActiveWindow(view);
415         setCurrentView(*view);
416 }
417
418
419
420
421 Clipboard & GuiApplication::clipboard()
422 {
423         return clipboard_;
424 }
425
426
427 Selection & GuiApplication::selection()
428 {
429         return selection_;
430 }
431
432
433 int GuiApplication::exec()
434 {
435         QTimer::singleShot(1, this, SLOT(execBatchCommands()));
436         return QApplication::exec();
437 }
438
439
440 void GuiApplication::exit(int status)
441 {
442         QApplication::exit(status);
443 }
444
445
446 void GuiApplication::execBatchCommands()
447 {
448         LyX::ref().execBatchCommands();
449 }
450
451
452 void GuiApplication::restoreGuiSession()
453 {
454         if (!lyxrc.load_session)
455                 return;
456
457         Session & session = LyX::ref().session();
458         vector<FileName> const & lastopened = session.lastOpened().getfiles();
459         // do not add to the lastfile list since these files are restored from
460         // last session, and should be already there (regular files), or should
461         // not be added at all (help files).
462         for_each(lastopened.begin(), lastopened.end(),
463                 bind(&GuiView::loadDocument, current_view_, _1, false));
464
465         // clear this list to save a few bytes of RAM
466         session.lastOpened().clear();
467 }
468
469
470 QString const GuiApplication::romanFontName()
471 {
472         QFont font;
473         font.setKerning(false);
474         font.setStyleHint(QFont::Serif);
475         font.setFamily("serif");
476
477         return QFontInfo(font).family();
478 }
479
480
481 QString const GuiApplication::sansFontName()
482 {
483         QFont font;
484         font.setKerning(false);
485         font.setStyleHint(QFont::SansSerif);
486         font.setFamily("sans");
487
488         return QFontInfo(font).family();
489 }
490
491
492 QString const GuiApplication::typewriterFontName()
493 {
494         QFont font;
495         font.setKerning(false);
496         font.setStyleHint(QFont::TypeWriter);
497         font.setFamily("monospace");
498
499         return QFontInfo(font).family();
500 }
501
502
503 void GuiApplication::handleRegularEvents()
504 {
505         ForkedCallsController::handleCompletedProcesses();
506 }
507
508
509 bool GuiApplication::event(QEvent * e)
510 {
511         switch(e->type()) {
512         case QEvent::FileOpen: {
513                 // Open a file; this happens only on Mac OS X for now
514                 QFileOpenEvent * foe = static_cast<QFileOpenEvent *>(e);
515
516                 if (!current_view_ || !current_view_->view())
517                         // The application is not properly initialized yet.
518                         // So we acknowledge the event and delay the file opening
519                         // until LyX is ready.
520                         // FIXME UNICODE: FileName accept an utf8 encoded string.
521                         LyX::ref().addFileToLoad(fromqstr(foe->file()));
522                 else
523                         lyx::dispatch(FuncRequest(LFUN_FILE_OPEN,
524                                 qstring_to_ucs4(foe->file())));
525
526                 e->accept();
527                 return true;
528         }
529         default:
530                 return QApplication::event(e);
531         }
532 }
533
534
535 bool GuiApplication::notify(QObject * receiver, QEvent * event)
536 {
537         try {
538                 return QApplication::notify(receiver, event);
539         }
540         catch (ExceptionMessage const & e) {
541                 switch(e.type_) { 
542                 case ErrorException:
543                         LyX::cref().emergencyCleanup();
544                         setQuitOnLastWindowClosed(false);
545                         closeAllViews();
546                         Alert::error(e.title_, e.details_);
547 #ifndef NDEBUG
548                         // Properly crash in debug mode in order to get a useful backtrace.
549                         abort();
550 #endif
551                         // In release mode, try to exit gracefully.
552                         this->exit(1);
553
554                 case BufferException: {
555                         Buffer * buf = current_view_->buffer();
556                         docstring details = e.details_ + '\n';
557                         details += theBufferList().emergencyWrite(buf);
558                         theBufferList().release(buf);
559                         details += _("\nThe current document was closed.");
560                         Alert::error(e.title_, details);
561                         return false;
562                 }
563                 case WarningException:
564                         Alert::warning(e.title_, e.details_);
565                         return false;
566                 };
567         }
568         catch (exception const & e) {
569                 docstring s = _("LyX has caught an exception, it will now "
570                         "attempt to save all unsaved documents and exit."
571                         "\n\nException: ");
572                 s += from_ascii(e.what());
573                 Alert::error(_("Software exception Detected"), s);
574                 LyX::cref().exit(1);
575         }
576         catch (...) {
577                 docstring s = _("LyX has caught some really weird exception, it will "
578                         "now attempt to save all unsaved documents and exit.");
579                 Alert::error(_("Software exception Detected"), s);
580                 LyX::cref().exit(1);
581         }
582
583         return false;
584 }
585
586
587 bool GuiApplication::getRgbColor(ColorCode col, RGBColor & rgbcol)
588 {
589         QColor const & qcol = color_cache_.get(col);
590         if (!qcol.isValid()) {
591                 rgbcol.r = 0;
592                 rgbcol.g = 0;
593                 rgbcol.b = 0;
594                 return false;
595         }
596         rgbcol.r = qcol.red();
597         rgbcol.g = qcol.green();
598         rgbcol.b = qcol.blue();
599         return true;
600 }
601
602
603 string const GuiApplication::hexName(ColorCode col)
604 {
605         return ltrim(fromqstr(color_cache_.get(col).name()), "#");
606 }
607
608
609 void GuiApplication::updateColor(ColorCode)
610 {
611         // FIXME: Bleh, can't we just clear them all at once ?
612         color_cache_.clear();
613 }
614
615
616 void GuiApplication::registerSocketCallback(int fd, SocketCallback func)
617 {
618         SocketNotifier * sn = new SocketNotifier(this, fd, func);
619         socket_notifiers_[fd] = sn;
620         connect(sn, SIGNAL(activated(int)), this, SLOT(socketDataReceived(int)));
621 }
622
623
624 void GuiApplication::socketDataReceived(int fd)
625 {
626         socket_notifiers_[fd]->func_();
627 }
628
629
630 void GuiApplication::unregisterSocketCallback(int fd)
631 {
632         socket_notifiers_.erase(fd);
633 }
634
635
636 void GuiApplication::commitData(QSessionManager & sm)
637 {
638         /// The implementation is required to avoid an application exit
639         /// when session state save is triggered by session manager.
640         /// The default implementation sends a close event to all
641         /// visible top level widgets when session managment allows
642         /// interaction.
643         /// We are changing that to close all wiew one by one.
644         /// FIXME: verify if the default implementation is enough now.
645         if (sm.allowsInteraction() && !closeAllViews())
646                 sm.cancel();
647 }
648
649
650 void GuiApplication::addMenuTranslator()
651 {
652         installTranslator(new MenuTranslator(this));
653 }
654
655
656 bool GuiApplication::unregisterView(int id)
657 {
658         updateIds(views_, view_ids_);
659         BOOST_ASSERT(views_.find(id) != views_.end());
660         BOOST_ASSERT(views_[id]);
661
662         map<int, GuiView *>::iterator it;
663         for (it = views_.begin(); it != views_.end(); ++it) {
664                 if (it->first == id) {
665                         views_.erase(id);
666                         break;
667                 }
668         }
669         updateIds(views_, view_ids_);
670         return true;
671 }
672
673
674 bool GuiApplication::closeAllViews()
675 {
676         updateIds(views_, view_ids_);
677         if (views_.empty())
678                 return true;
679
680         map<int, GuiView*> const cmap = views_;
681         map<int, GuiView*>::const_iterator it;
682         for (it = cmap.begin(); it != cmap.end(); ++it) {
683                 if (!it->second->close())
684                         return false;
685         }
686
687         views_.clear();
688         view_ids_.clear();
689         return true;
690 }
691
692
693 GuiView & GuiApplication::view(int id) const
694 {
695         BOOST_ASSERT(views_.find(id) != views_.end());
696         return *views_.find(id)->second;
697 }
698
699
700 void GuiApplication::hideDialogs(string const & name, Inset * inset) const
701 {
702         vector<int>::const_iterator it = view_ids_.begin();
703         vector<int>::const_iterator const end = view_ids_.end();
704         for (; it != end; ++it)
705                 view(*it).hideDialog(name, inset);
706 }
707
708
709 Buffer const * GuiApplication::updateInset(Inset const * inset) const
710 {
711         Buffer const * buffer_ = 0;
712         vector<int>::const_iterator it = view_ids_.begin();
713         vector<int>::const_iterator const end = view_ids_.end();
714         for (; it != end; ++it) {
715                 Buffer const * ptr = view(*it).updateInset(inset);
716                 if (ptr)
717                         buffer_ = ptr;
718         }
719         return buffer_;
720 }
721
722
723 void GuiApplication::readMenus(Lexer & lex)
724 {
725         menus().read(lex);
726 }
727
728
729 bool GuiApplication::searchMenu(FuncRequest const & func,
730         vector<docstring> & names) const
731 {
732         return menus().searchMenu(func, names);
733 }
734
735
736 void GuiApplication::initGlobalMenu()
737 {
738         if (global_menubar_)
739                 menus().fillMenuBar(global_menubar_, 0);
740 }
741
742
743 void GuiApplication::onLastWindowClosed()
744 {
745         if (global_menubar_)
746                 global_menubar_->grabKeyboard();
747 }
748
749 ////////////////////////////////////////////////////////////////////////
750 // X11 specific stuff goes here...
751 #ifdef Q_WS_X11
752 bool GuiApplication::x11EventFilter(XEvent * xev)
753 {
754         if (!current_view_)
755                 return false;
756
757         switch (xev->type) {
758         case SelectionRequest: {
759                 if (xev->xselectionrequest.selection != XA_PRIMARY)
760                         break;
761                 LYXERR(Debug::GUI, "X requested selection.");
762                 BufferView * bv = current_view_->view();
763                 if (bv) {
764                         docstring const sel = bv->requestSelection();
765                         if (!sel.empty())
766                                 selection_.put(sel);
767                 }
768                 break;
769         }
770         case SelectionClear: {
771                 if (xev->xselectionclear.selection != XA_PRIMARY)
772                         break;
773                 LYXERR(Debug::GUI, "Lost selection.");
774                 BufferView * bv = current_view_->view();
775                 if (bv)
776                         bv->clearSelection();
777                 break;
778         }
779         }
780         return false;
781 }
782 #endif
783
784 } // namespace frontend
785
786
787 ////////////////////////////////////////////////////////////////////
788 //
789 // Font stuff
790 //
791 ////////////////////////////////////////////////////////////////////
792
793 frontend::FontLoader & theFontLoader()
794 {
795         BOOST_ASSERT(frontend::guiApp);
796         return frontend::guiApp->fontLoader();
797 }
798
799
800 frontend::FontMetrics const & theFontMetrics(Font const & f)
801 {
802         return theFontMetrics(f.fontInfo());
803 }
804
805
806 frontend::FontMetrics const & theFontMetrics(FontInfo const & f)
807 {
808         BOOST_ASSERT(frontend::guiApp);
809         return frontend::guiApp->fontLoader().metrics(f);
810 }
811
812
813 frontend::Clipboard & theClipboard()
814 {
815         BOOST_ASSERT(frontend::guiApp);
816         return frontend::guiApp->clipboard();
817 }
818
819
820 frontend::Selection & theSelection()
821 {
822         BOOST_ASSERT(frontend::guiApp);
823         return frontend::guiApp->selection();
824 }
825
826 } // namespace lyx
827
828 #include "GuiApplication_moc.cpp"