3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
8 * \author Abdelrazak Younes
11 * Full author contact details are available in file CREDITS.
18 #include "GuiApplication.h"
19 #include "GuiWorkArea.h"
20 #include "GuiKeySymbol.h"
21 #include "GuiMenubar.h"
22 #include "GuiToolbar.h"
23 #include "GuiToolbars.h"
26 #include "qt_helpers.h"
28 #include "frontends/Dialogs.h"
30 #include "support/filetools.h"
31 #include "support/convert.h"
32 #include "support/lstrings.h"
33 #include "support/os.h"
35 #include "buffer_funcs.h"
37 #include "BufferList.h"
38 #include "BufferParams.h"
39 #include "BufferView.h"
42 #include "ErrorList.h"
43 #include "FuncRequest.h"
50 #include "MenuBackend.h"
51 #include "Paragraph.h"
52 #include "TextClass.h"
54 #include "ToolbarBackend.h"
57 #include "support/lstrings.h"
58 #include "support/filetools.h" // OnlyFilename()
59 #include "support/Timeout.h"
62 #include <QApplication>
63 #include <QCloseEvent>
64 #include <QDesktopWidget>
65 #include <QDragEnterEvent>
72 #include <QPushButton>
76 #include <QStackedWidget>
81 #include <boost/bind.hpp>
82 #include <boost/current_function.hpp>
84 #ifdef HAVE_SYS_TIME_H
85 # include <sys/time.h>
101 using support::bformat;
102 using support::FileName;
103 using support::makeDisplayPath;
104 using support::onlyFilename;
108 int const statusbar_timer_value = 3000;
110 class BackgroundWidget : public QWidget
113 BackgroundWidget(QString const & file, QString const & text)
115 splash_ = new QPixmap(file);
117 lyxerr << "could not load splash screen: '" << fromqstr(file) << "'" << endl;
121 QPainter pain(splash_);
122 pain.setPen(QColor(255, 255, 0));
124 // The font used to display the version info
125 font.setStyleHint(QFont::SansSerif);
126 font.setWeight(QFont::Bold);
127 font.setPointSize(convert<int>(lyxrc.font_sizes[FONT_SIZE_LARGE]));
129 pain.drawText(260, 270, text);
132 void paintEvent(QPaintEvent *)
137 int x = (width() - splash_->width()) / 2;
138 int y = (height() - splash_->height()) / 2;
140 pain.drawPixmap(x, y, *splash_);
150 struct GuiView::GuiViewPrivate
153 : current_work_area_(0), posx_offset(0), posy_offset(0)
160 delete stack_widget_;
165 unsigned int smallIconSize;
166 unsigned int normalIconSize;
167 unsigned int bigIconSize;
168 // static needed by "New Window"
169 static unsigned int lastIconSize;
171 QMenu * toolBarPopup(GuiView * parent)
173 // FIXME: translation
174 QMenu * menu = new QMenu(parent);
175 QActionGroup * iconSizeGroup = new QActionGroup(parent);
177 QAction * smallIcons = new QAction(iconSizeGroup);
178 smallIcons->setText(qt_("Small-sized icons"));
179 smallIcons->setCheckable(true);
180 QObject::connect(smallIcons, SIGNAL(triggered()),
181 parent, SLOT(smallSizedIcons()));
182 menu->addAction(smallIcons);
184 QAction * normalIcons = new QAction(iconSizeGroup);
185 normalIcons->setText(qt_("Normal-sized icons"));
186 normalIcons->setCheckable(true);
187 QObject::connect(normalIcons, SIGNAL(triggered()),
188 parent, SLOT(normalSizedIcons()));
189 menu->addAction(normalIcons);
191 QAction * bigIcons = new QAction(iconSizeGroup);
192 bigIcons->setText(qt_("Big-sized icons"));
193 bigIcons->setCheckable(true);
194 QObject::connect(bigIcons, SIGNAL(triggered()),
195 parent, SLOT(bigSizedIcons()));
196 menu->addAction(bigIcons);
198 unsigned int cur = parent->iconSize().width();
199 if ( cur == parent->d.smallIconSize)
200 smallIcons->setChecked(true);
201 else if (cur == parent->d.normalIconSize)
202 normalIcons->setChecked(true);
203 else if (cur == parent->d.bigIconSize)
204 bigIcons->setChecked(true);
209 void initBackground()
211 LYXERR(Debug::GUI, "show banner: " << lyxrc.show_banner);
212 /// The text to be written on top of the pixmap
213 QString const text = lyx_version ? QString(lyx_version) : qt_("unknown version");
214 bg_widget_ = new BackgroundWidget(":/images/banner.png", text);
219 stack_widget_->setCurrentWidget(bg_widget_);
220 bg_widget_->setUpdatesEnabled(true);
223 TabWorkArea * tabWorkArea(int i)
225 return dynamic_cast<TabWorkArea *>(splitter_->widget(i));
228 TabWorkArea * currentTabWorkArea()
230 if (splitter_->count() == 1)
231 // The first TabWorkArea is always the first one, if any.
232 return tabWorkArea(0);
234 TabWorkArea * tab_widget = 0;
235 for (int i = 0; i != splitter_->count(); ++i) {
236 QWidget * w = splitter_->widget(i);
239 tab_widget = dynamic_cast<TabWorkArea *>(w);
251 GuiWorkArea * current_work_area_;
255 QSplitter * splitter_;
256 QStackedWidget * stack_widget_;
257 BackgroundWidget * bg_widget_;
259 GuiMenubar * menubar_;
261 GuiToolbars * toolbars_;
263 docstring current_layout;
267 unsigned int GuiView::GuiViewPrivate::lastIconSize = 0;
270 GuiView::GuiView(int id)
271 : QMainWindow(), LyXView(id),
272 d(*new GuiViewPrivate),
273 quitting_by_menu_(false),
274 autosave_timeout_(new Timeout(5000)),
275 dialogs_(new Dialogs(*this))
277 // Start autosave timer
278 if (lyxrc.autosave) {
279 autosave_timeout_->timeout.connect(boost::bind(&GuiView::autoSave, this));
280 autosave_timeout_->setTimeout(lyxrc.autosave * 1000);
281 autosave_timeout_->start();
284 // Qt bug? signal lastWindowClosed does not work
285 setAttribute(Qt::WA_QuitOnClose, false);
286 setAttribute(Qt::WA_DeleteOnClose, true);
288 // hardcode here the platform specific icon size
289 d.smallIconSize = 14; // scaling problems
290 d.normalIconSize = 20; // ok, default
291 d.bigIconSize = 26; // better for some math icons
294 // assign an icon to main form. We do not do it under Qt/Mac,
295 // since the icon is provided in the application bundle.
296 setWindowIcon(QPixmap(":/images/lyx.png"));
300 d.splitter_ = new QSplitter;
303 LYXERR(Debug::GUI, "stack widget!");
304 d.stack_widget_ = new QStackedWidget;
305 d.stack_widget_->addWidget(d.bg_widget_);
306 d.stack_widget_->addWidget(d.splitter_);
307 setCentralWidget(d.stack_widget_);
310 setAcceptDrops(true);
317 delete autosave_timeout_;
322 void GuiView::close()
324 quitting_by_menu_ = true;
325 d.current_work_area_ = 0;
326 for (int i = 0; i != d.splitter_->count(); ++i) {
327 TabWorkArea * twa = d.tabWorkArea(i);
331 QMainWindow::close();
332 quitting_by_menu_ = false;
336 void GuiView::setFocus()
338 if (d.current_work_area_)
339 d.current_work_area_->setFocus();
345 QMenu* GuiView::createPopupMenu()
347 return d.toolBarPopup(this);
353 setMinimumSize(300, 200);
354 // GuiToolbars *must* be initialised before GuiMenubar.
355 d.toolbars_ = new GuiToolbars(*this);
356 // FIXME: GuiToolbars::init() cannot be integrated in the ctor
357 // because LyXFunc::getStatus() needs a properly initialized
358 // GuiToolbars object (for LFUN_TOOLBAR_TOGGLE).
360 d.menubar_ = new GuiMenubar(this, menubackend);
362 statusBar()->setSizeGripEnabled(true);
364 QObject::connect(&statusbar_timer_, SIGNAL(timeout()),
365 this, SLOT(clearMessage()));
369 if (!lyxrc.allow_geometry_session)
370 setGeometry(50, 50, 690, 510);
372 // Now take care of session management.
374 QString const key = "view-" + QString::number(id());
376 QPoint pos = settings.value(key + "/pos", QPoint(50, 50)).toPoint();
377 QSize size = settings.value(key + "/size", QSize(690, 510)).toSize();
381 if (!restoreGeometry(settings.value(key + "/geometry").toByteArray()))
382 setGeometry(50, 50, 690, 510);
384 setIconSize(settings.value(key + "/icon_size").toSize());
388 void GuiView::showEvent(QShowEvent * e)
390 LYXERR(Debug::GUI, "Passed Geometry "
391 << size().height() << "x" << size().width()
392 << "+" << pos().x() << "+" << pos().y());
394 if (d.splitter_->count() == 0)
395 // No work area, switch to the background widget.
398 QMainWindow::showEvent(e);
402 void GuiView::closeEvent(QCloseEvent * close_event)
404 // we may have been called through the close window button
405 // which bypasses the LFUN machinery.
406 if (!quitting_by_menu_ && guiApp->viewCount() == 1) {
407 if (!theBufferList().quitWriteAll()) {
408 close_event->ignore();
413 // Make sure that no LFUN use this close to be closed View.
414 theLyXFunc().setLyXView(0);
415 // Make sure the timer time out will not trigger a statusbar update.
416 statusbar_timer_.stop();
418 if (lyxrc.allow_geometry_session) {
420 QString const key = "view-" + QString::number(id());
422 settings.setValue(key + "/pos", pos());
423 settings.setValue(key + "/size", size());
425 settings.setValue(key + "/geometry", saveGeometry());
427 settings.setValue(key + "/icon_size", iconSize());
428 d.toolbars_->saveToolbarInfo();
431 guiApp->unregisterView(id());
432 if (guiApp->viewCount() > 0) {
433 // Just close the window and do nothing else if this is not the
435 close_event->accept();
441 // this is the place where we leave the frontend.
442 // it is the only point at which we start quitting.
443 close_event->accept();
444 // quit the event loop
449 void GuiView::dragEnterEvent(QDragEnterEvent * event)
451 if (event->mimeData()->hasUrls())
453 /// \todo Ask lyx-devel is this is enough:
454 /// if (event->mimeData()->hasFormat("text/plain"))
455 /// event->acceptProposedAction();
459 void GuiView::dropEvent(QDropEvent* event)
461 QList<QUrl> files = event->mimeData()->urls();
465 LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION << " got URLs!");
466 for (int i = 0; i != files.size(); ++i) {
467 string const file = support::os::internal_path(fromqstr(
468 files.at(i).toLocalFile()));
470 dispatch(FuncRequest(LFUN_FILE_OPEN, file));
475 void GuiView::message(docstring const & str)
477 statusBar()->showMessage(toqstr(str));
478 statusbar_timer_.stop();
479 statusbar_timer_.start(statusbar_timer_value);
483 void GuiView::smallSizedIcons()
485 setIconSize(QSize(d.smallIconSize, d.smallIconSize));
489 void GuiView::normalSizedIcons()
491 setIconSize(QSize(d.normalIconSize, d.normalIconSize));
495 void GuiView::bigSizedIcons()
497 setIconSize(QSize(d.bigIconSize, d.bigIconSize));
501 void GuiView::clearMessage()
505 theLyXFunc().setLyXView(this);
506 statusBar()->showMessage(toqstr(theLyXFunc().viewStatusMessage()));
507 statusbar_timer_.stop();
511 void GuiView::updateWindowTitle(GuiWorkArea * wa)
513 if (wa != d.current_work_area_)
515 setWindowTitle(qt_("LyX: ") + wa->windowTitle());
516 setWindowIconText(wa->windowIconText());
520 void GuiView::on_currentWorkAreaChanged(GuiWorkArea * wa)
523 disconnectBufferView();
524 connectBufferView(wa->bufferView());
525 connectBuffer(wa->bufferView().buffer());
526 d.current_work_area_ = wa;
527 QObject::connect(wa, SIGNAL(titleChanged(GuiWorkArea *)),
528 this, SLOT(updateWindowTitle(GuiWorkArea *)));
529 updateWindowTitle(wa);
532 // Buffer-dependent dialogs should be updated or
533 // hidden. This should go here because some dialogs (eg ToC)
534 // require bv_->text.
535 dialogs_->updateBufferDependent(true);
537 updateLayoutChoice(false);
542 void GuiView::updateStatusBar()
544 // let the user see the explicit message
545 if (statusbar_timer_.isActive())
548 statusBar()->showMessage(toqstr(theLyXFunc().viewStatusMessage()));
552 bool GuiView::hasFocus() const
554 return qApp->activeWindow() == this;
558 bool GuiView::event(QEvent * e)
562 // Useful debug code:
563 //case QEvent::ActivationChange:
564 //case QEvent::WindowDeactivate:
565 //case QEvent::Paint:
566 //case QEvent::Enter:
567 //case QEvent::Leave:
568 //case QEvent::HoverEnter:
569 //case QEvent::HoverLeave:
570 //case QEvent::HoverMove:
571 //case QEvent::StatusTip:
572 //case QEvent::DragEnter:
573 //case QEvent::DragLeave:
577 case QEvent::WindowActivate: {
578 guiApp->setCurrentView(*this);
579 if (d.current_work_area_) {
580 BufferView & bv = d.current_work_area_->bufferView();
581 connectBufferView(bv);
582 connectBuffer(bv.buffer());
583 // The document structure, name and dialogs might have
584 // changed in another view.
585 dialogs_->updateBufferDependent(true);
587 setWindowTitle(qt_("LyX"));
588 setWindowIconText(qt_("LyX"));
590 return QMainWindow::event(e);
592 case QEvent::ShortcutOverride: {
593 QKeyEvent * ke = static_cast<QKeyEvent*>(e);
594 if (!d.current_work_area_) {
595 theLyXFunc().setLyXView(this);
597 setKeySymbol(&sym, ke);
598 theLyXFunc().processKeySym(sym, q_key_state(ke->modifiers()));
602 if (ke->key() == Qt::Key_Tab || ke->key() == Qt::Key_Backtab) {
604 setKeySymbol(&sym, ke);
605 d.current_work_area_->processKeySym(sym, NoModifier);
611 return QMainWindow::event(e);
616 bool GuiView::focusNextPrevChild(bool /*next*/)
623 void GuiView::setBusy(bool yes)
625 if (d.current_work_area_) {
626 d.current_work_area_->setUpdatesEnabled(!yes);
628 d.current_work_area_->stopBlinkingCursor();
630 d.current_work_area_->startBlinkingCursor();
634 QApplication::setOverrideCursor(Qt::WaitCursor);
636 QApplication::restoreOverrideCursor();
640 GuiToolbar * GuiView::makeToolbar(ToolbarInfo const & tbinfo, bool newline)
642 GuiToolbar * toolBar = new GuiToolbar(tbinfo, *this);
644 if (tbinfo.flags & ToolbarInfo::TOP) {
646 addToolBarBreak(Qt::TopToolBarArea);
647 addToolBar(Qt::TopToolBarArea, toolBar);
650 if (tbinfo.flags & ToolbarInfo::BOTTOM) {
651 // Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
652 #if (QT_VERSION >= 0x040202)
654 addToolBarBreak(Qt::BottomToolBarArea);
656 addToolBar(Qt::BottomToolBarArea, toolBar);
659 if (tbinfo.flags & ToolbarInfo::LEFT) {
660 // Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
661 #if (QT_VERSION >= 0x040202)
663 addToolBarBreak(Qt::LeftToolBarArea);
665 addToolBar(Qt::LeftToolBarArea, toolBar);
668 if (tbinfo.flags & ToolbarInfo::RIGHT) {
669 // Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
670 #if (QT_VERSION >= 0x040202)
672 addToolBarBreak(Qt::RightToolBarArea);
674 addToolBar(Qt::RightToolBarArea, toolBar);
677 // The following does not work so I cannot restore to exact toolbar location
679 ToolbarSection::ToolbarInfo & tbinfo = LyX::ref().session().toolbars().load(tbinfo.name);
680 toolBar->move(tbinfo.posx, tbinfo.posy);
687 GuiWorkArea * GuiView::workArea(Buffer & buffer)
689 for (int i = 0; i != d.splitter_->count(); ++i) {
690 GuiWorkArea * wa = d.tabWorkArea(i)->workArea(buffer);
698 GuiWorkArea * GuiView::addWorkArea(Buffer & buffer)
700 GuiWorkArea * wa = new GuiWorkArea(buffer, *this);
701 wa->setUpdatesEnabled(false);
703 // Automatically create a TabWorkArea if there are none yet.
704 if (!d.splitter_->count())
707 TabWorkArea * tab_widget = d.currentTabWorkArea();
708 tab_widget->addTab(wa, wa->windowTitle());
709 QObject::connect(wa, SIGNAL(titleChanged(GuiWorkArea *)),
710 tab_widget, SLOT(updateTabText(GuiWorkArea *)));
712 wa->bufferView().updateMetrics();
714 // Hide tabbar if there's only one tab.
715 tab_widget->showBar(tab_widget->count() > 1);
720 void GuiView::addTabWorkArea()
722 TabWorkArea * twa = new TabWorkArea;
723 QObject::connect(twa, SIGNAL(currentWorkAreaChanged(GuiWorkArea *)),
724 this, SLOT(on_currentWorkAreaChanged(GuiWorkArea *)));
725 d.splitter_->addWidget(twa);
726 d.stack_widget_->setCurrentWidget(d.splitter_);
730 GuiWorkArea const * GuiView::currentWorkArea() const
732 return d.current_work_area_;
736 void GuiView::setCurrentWorkArea(GuiWorkArea * work_area)
738 BOOST_ASSERT(work_area);
740 // Changing work area can result from opening a file so
741 // update the toc in any case.
744 GuiWorkArea * wa = static_cast<GuiWorkArea *>(work_area);
745 d.current_work_area_ = wa;
746 for (int i = 0; i != d.splitter_->count(); ++i) {
747 if (d.tabWorkArea(i)->setCurrentWorkArea(wa))
753 void GuiView::removeWorkArea(GuiWorkArea * work_area)
755 BOOST_ASSERT(work_area);
756 GuiWorkArea * gwa = static_cast<GuiWorkArea *>(work_area);
757 if (gwa == d.current_work_area_) {
759 disconnectBufferView();
760 dialogs_->hideBufferDependent();
761 d.current_work_area_ = 0;
764 // removing a work area often results from closing a file so
765 // update the toc in any case.
768 for (int i = 0; i != d.splitter_->count(); ++i) {
769 TabWorkArea * twa = d.tabWorkArea(i);
770 if (!twa->removeWorkArea(gwa))
771 // Not found in this tab group.
774 // We found and removed the GuiWorkArea.
776 // No more WorkAreas in this tab group, so delete it.
781 if (d.current_work_area_)
782 // This means that we are not closing the current GuiWorkArea;
785 // Switch to the next GuiWorkArea in the found TabWorkArea.
786 d.current_work_area_ = twa->currentWorkArea();
790 if (d.splitter_->count() == 0)
791 // No more work area, switch to the background widget.
796 void GuiView::updateLayoutChoice(bool force)
798 // Don't show any layouts without a buffer
800 d.toolbars_->clearLayoutList();
804 // Update the layout display
805 if (d.toolbars_->updateLayoutList(buffer()->params().getTextClassPtr(), force)) {
806 d.current_layout = buffer()->params().getTextClass().defaultLayoutName();
809 docstring const & layout = d.current_work_area_->bufferView().cursor().
810 innerParagraph().layout()->name();
812 if (layout != d.current_layout) {
813 d.toolbars_->setLayout(layout);
814 d.current_layout = layout;
819 bool GuiView::isToolbarVisible(std::string const & id)
821 return d.toolbars_->visible(id);
824 void GuiView::updateToolbars()
826 if (d.current_work_area_) {
828 d.current_work_area_->bufferView().cursor().inMathed();
830 lyx::getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
832 lyx::getStatus(FuncRequest(LFUN_CHANGES_TRACK)).enabled() &&
833 lyx::getStatus(FuncRequest(LFUN_CHANGES_TRACK)).onoff(true);
835 d.toolbars_->update(math, table, review);
837 d.toolbars_->update(false, false, false);
839 // update read-only status of open dialogs.
840 dialogs_->checkStatus();
844 Buffer * GuiView::buffer()
846 if (d.current_work_area_)
847 return &d.current_work_area_->bufferView().buffer();
852 Buffer const * GuiView::buffer() const
854 if (d.current_work_area_)
855 return &d.current_work_area_->bufferView().buffer();
860 void GuiView::setBuffer(Buffer * newBuffer)
862 BOOST_ASSERT(newBuffer);
865 GuiWorkArea * wa = workArea(*newBuffer);
867 updateLabels(*newBuffer->masterBuffer());
868 wa = addWorkArea(*newBuffer);
870 //Disconnect the old buffer...there's no new one.
873 connectBuffer(*newBuffer);
874 connectBufferView(wa->bufferView());
875 setCurrentWorkArea(wa);
881 Buffer * GuiView::loadLyXFile(FileName const & filename, bool tolastfiles)
885 Buffer * newBuffer = checkAndLoadLyXFile(filename);
888 message(_("Document not loaded."));
894 GuiWorkArea * wa = workArea(*newBuffer);
896 wa = addWorkArea(*newBuffer);
898 // scroll to the position when the file was last closed
899 if (lyxrc.use_lastfilepos) {
900 LastFilePosSection::FilePos filepos =
901 LyX::ref().session().lastFilePos().load(filename);
902 // if successfully move to pit (returned par_id is not zero),
903 // update metrics and reset font
904 wa->bufferView().moveToPosition(filepos.pit, filepos.pos, 0, 0);
908 LyX::ref().session().lastFiles().add(filename);
915 void GuiView::connectBuffer(Buffer & buf)
917 buf.setGuiDelegate(this);
921 void GuiView::disconnectBuffer()
923 if (d.current_work_area_)
924 d.current_work_area_->bufferView().setGuiDelegate(0);
928 void GuiView::connectBufferView(BufferView & bv)
930 bv.setGuiDelegate(this);
934 void GuiView::disconnectBufferView()
936 if (d.current_work_area_)
937 d.current_work_area_->bufferView().setGuiDelegate(0);
941 void GuiView::errors(string const & error_type)
943 ErrorList & el = buffer()->errorList(error_type);
945 dialogs_->show("errorlist", error_type);
949 void GuiView::showDialog(string const & name)
951 dialogs_->show(name);
955 void GuiView::showDialogWithData(string const & name, string const & data)
957 dialogs_->show(name, data);
961 void GuiView::showInsetDialog(string const & name, string const & data,
964 dialogs_->show(name, data, inset);
968 void GuiView::updateDialog(string const & name, string const & data)
970 if (dialogs_->visible(name))
971 dialogs_->update(name, data);
975 BufferView * GuiView::view()
977 return d.current_work_area_ ? &d.current_work_area_->bufferView() : 0;
981 void GuiView::updateToc()
983 updateDialog("toc", "");
987 void GuiView::updateEmbeddedFiles()
989 updateDialog("embedding", "");
993 void GuiView::autoSave()
995 LYXERR(Debug::INFO, "Running autoSave()");
998 view()->buffer().autoSave();
1002 void GuiView::resetAutosaveTimers()
1005 autosave_timeout_->restart();
1009 void GuiView::dispatch(FuncRequest const & cmd)
1011 switch(cmd.action) {
1012 case LFUN_BUFFER_SWITCH:
1013 setBuffer(theBufferList().getBuffer(to_utf8(cmd.argument())));
1016 case LFUN_COMMAND_EXECUTE: {
1017 bool const show_it = cmd.argument() != "off";
1018 d.toolbars_->showCommandBuffer(show_it);
1021 case LFUN_DROP_LAYOUTS_CHOICE:
1022 d.toolbars_->openLayoutList();
1025 case LFUN_MENU_OPEN:
1026 d.menubar_->openByName(toqstr(cmd.argument()));
1029 case LFUN_TOOLBAR_TOGGLE: {
1030 string const name = cmd.getArg(0);
1031 bool const allowauto = cmd.getArg(1) == "allowauto";
1032 // it is possible to get current toolbar status like this,...
1033 // but I decide to obey the order of ToolbarBackend::flags
1034 // and disregard real toolbar status.
1035 // toolbars_->saveToolbarInfo();
1037 // toggle state on/off/auto
1038 d.toolbars_->toggleToolbarState(name, allowauto);
1042 ToolbarInfo * tbi = d.toolbars_->getToolbarInfo(name);
1044 message(bformat(_("Unknown toolbar \"%1$s\""), from_utf8(name)));
1048 if (tbi->flags & ToolbarInfo::ON)
1050 else if (tbi->flags & ToolbarInfo::OFF)
1052 else if (tbi->flags & ToolbarInfo::AUTO)
1055 message(bformat(_("Toolbar \"%1$s\" state set to %2$s"),
1056 _(tbi->gui_name), state));
1061 theLyXFunc().setLyXView(this);
1067 Buffer const * GuiView::updateInset(Inset const * inset)
1069 if (!d.current_work_area_)
1073 d.current_work_area_->scheduleRedraw();
1075 return &d.current_work_area_->bufferView().buffer();
1079 void GuiView::restartCursor()
1081 /* When we move around, or type, it's nice to be able to see
1082 * the cursor immediately after the keypress.
1084 if (d.current_work_area_)
1085 d.current_work_area_->startBlinkingCursor();
1088 } // namespace frontend
1091 #include "GuiView_moc.cpp"