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 "GuiImplementation.h"
19 #include "GuiWorkArea.h"
20 #include "GuiKeySymbol.h"
21 #include "GuiMenubar.h"
22 #include "GuiToolbar.h"
23 #include "GuiToolbars.h"
27 #include "qt_helpers.h"
29 #include "frontends/Application.h"
30 #include "frontends/Dialogs.h"
31 #include "frontends/Gui.h"
33 #include "support/filetools.h"
34 #include "support/convert.h"
35 #include "support/lstrings.h"
36 #include "support/os.h"
38 #include "buffer_funcs.h"
40 #include "BufferList.h"
41 #include "BufferParams.h"
42 #include "BufferView.h"
45 #include "ErrorList.h"
46 #include "FuncRequest.h"
53 #include "MenuBackend.h"
54 #include "Paragraph.h"
55 #include "TextClass.h"
57 #include "ToolbarBackend.h"
60 #include "support/lstrings.h"
61 #include "support/filetools.h" // OnlyFilename()
62 #include "support/Timeout.h"
65 #include <QApplication>
66 #include <QCloseEvent>
67 #include <QDesktopWidget>
68 #include <QDragEnterEvent>
75 #include <QPushButton>
79 #include <QStackedWidget>
84 #include <boost/bind.hpp>
85 #include <boost/current_function.hpp>
87 #ifdef HAVE_SYS_TIME_H
88 # include <sys/time.h>
100 extern bool quitting;
104 using support::bformat;
105 using support::FileName;
106 using support::makeDisplayPath;
107 using support::onlyFilename;
111 int const statusbar_timer_value = 3000;
113 class BackgroundWidget : public QWidget
116 BackgroundWidget(QString const & file, QString const & text)
118 splash_ = new QPixmap(file);
120 lyxerr << "could not load splash screen: '" << fromqstr(file) << "'" << endl;
124 QPainter pain(splash_);
125 pain.setPen(QColor(255, 255, 0));
127 // The font used to display the version info
128 font.setStyleHint(QFont::SansSerif);
129 font.setWeight(QFont::Bold);
130 font.setPointSize(convert<int>(lyxrc.font_sizes[FONT_SIZE_LARGE]));
132 pain.drawText(260, 270, text);
135 void paintEvent(QPaintEvent *)
140 int x = (width() - splash_->width()) / 2;
141 int y = (height() - splash_->height()) / 2;
143 pain.drawPixmap(x, y, *splash_);
153 struct GuiView::GuiViewPrivate
156 : current_work_area_(0), posx_offset(0), posy_offset(0)
163 delete stack_widget_;
168 unsigned int smallIconSize;
169 unsigned int normalIconSize;
170 unsigned int bigIconSize;
171 // static needed by "New Window"
172 static unsigned int lastIconSize;
174 QMenu * toolBarPopup(GuiView * parent)
176 // FIXME: translation
177 QMenu * menu = new QMenu(parent);
178 QActionGroup * iconSizeGroup = new QActionGroup(parent);
180 QAction * smallIcons = new QAction(iconSizeGroup);
181 smallIcons->setText(qt_("Small-sized icons"));
182 smallIcons->setCheckable(true);
183 QObject::connect(smallIcons, SIGNAL(triggered()),
184 parent, SLOT(smallSizedIcons()));
185 menu->addAction(smallIcons);
187 QAction * normalIcons = new QAction(iconSizeGroup);
188 normalIcons->setText(qt_("Normal-sized icons"));
189 normalIcons->setCheckable(true);
190 QObject::connect(normalIcons, SIGNAL(triggered()),
191 parent, SLOT(normalSizedIcons()));
192 menu->addAction(normalIcons);
194 QAction * bigIcons = new QAction(iconSizeGroup);
195 bigIcons->setText(qt_("Big-sized icons"));
196 bigIcons->setCheckable(true);
197 QObject::connect(bigIcons, SIGNAL(triggered()),
198 parent, SLOT(bigSizedIcons()));
199 menu->addAction(bigIcons);
201 unsigned int cur = parent->iconSize().width();
202 if ( cur == parent->d.smallIconSize)
203 smallIcons->setChecked(true);
204 else if (cur == parent->d.normalIconSize)
205 normalIcons->setChecked(true);
206 else if (cur == parent->d.bigIconSize)
207 bigIcons->setChecked(true);
212 void initBackground()
214 LYXERR(Debug::GUI, "show banner: " << lyxrc.show_banner);
215 /// The text to be written on top of the pixmap
216 QString const text = lyx_version ? QString(lyx_version) : qt_("unknown version");
217 bg_widget_ = new BackgroundWidget(":/images/banner.png", text);
222 stack_widget_->setCurrentWidget(bg_widget_);
223 bg_widget_->setUpdatesEnabled(true);
226 TabWorkArea * tabWorkArea(int i)
228 return dynamic_cast<TabWorkArea *>(splitter_->widget(i));
231 TabWorkArea * currentTabWorkArea()
233 if (splitter_->count() == 1)
234 // The first TabWorkArea is always the first one, if any.
235 return tabWorkArea(0);
237 TabWorkArea * tab_widget = 0;
238 for (int i = 0; i != splitter_->count(); ++i) {
239 QWidget * w = splitter_->widget(i);
242 tab_widget = dynamic_cast<TabWorkArea *>(w);
254 GuiWorkArea * current_work_area_;
258 QSplitter * splitter_;
259 QStackedWidget * stack_widget_;
260 BackgroundWidget * bg_widget_;
262 GuiMenubar * menubar_;
264 GuiToolbars * toolbars_;
266 docstring current_layout;
270 unsigned int GuiView::GuiViewPrivate::lastIconSize = 0;
273 GuiView::GuiView(int id)
274 : QMainWindow(), LyXView(id),
275 d(*new GuiViewPrivate),
276 quitting_by_menu_(false),
277 autosave_timeout_(new Timeout(5000)),
278 dialogs_(new Dialogs(*this))
280 // Start autosave timer
281 if (lyxrc.autosave) {
282 autosave_timeout_->timeout.connect(boost::bind(&GuiView::autoSave, this));
283 autosave_timeout_->setTimeout(lyxrc.autosave * 1000);
284 autosave_timeout_->start();
287 // Qt bug? signal lastWindowClosed does not work
288 setAttribute(Qt::WA_QuitOnClose, false);
289 setAttribute(Qt::WA_DeleteOnClose, true);
291 // hardcode here the platform specific icon size
292 d.smallIconSize = 14; // scaling problems
293 d.normalIconSize = 20; // ok, default
294 d.bigIconSize = 26; // better for some math icons
297 // assign an icon to main form. We do not do it under Qt/Mac,
298 // since the icon is provided in the application bundle.
299 setWindowIcon(QPixmap(":/images/lyx.png"));
303 d.splitter_ = new QSplitter;
306 LYXERR(Debug::GUI, "stack widget!");
307 d.stack_widget_ = new QStackedWidget;
308 d.stack_widget_->addWidget(d.bg_widget_);
309 d.stack_widget_->addWidget(d.splitter_);
310 setCentralWidget(d.stack_widget_);
313 setAcceptDrops(true);
320 delete autosave_timeout_;
325 void GuiView::close()
327 quitting_by_menu_ = true;
328 d.current_work_area_ = 0;
329 for (int i = 0; i != d.splitter_->count(); ++i) {
330 TabWorkArea * twa = d.tabWorkArea(i);
334 QMainWindow::close();
335 quitting_by_menu_ = false;
339 void GuiView::setFocus()
341 if (d.current_work_area_)
342 d.current_work_area_->setFocus();
348 QMenu* GuiView::createPopupMenu()
350 return d.toolBarPopup(this);
356 setMinimumSize(300, 200);
357 // GuiToolbars *must* be initialised before GuiMenubar.
358 d.toolbars_ = new GuiToolbars(*this);
359 // FIXME: GuiToolbars::init() cannot be integrated in the ctor
360 // because LyXFunc::getStatus() needs a properly initialized
361 // GuiToolbars object (for LFUN_TOOLBAR_TOGGLE).
363 d.menubar_ = new GuiMenubar(this, menubackend);
365 statusBar()->setSizeGripEnabled(true);
367 QObject::connect(&statusbar_timer_, SIGNAL(timeout()),
368 this, SLOT(clearMessage()));
372 if (!lyxrc.allow_geometry_session)
373 setGeometry(50, 50, 690, 510);
375 // Now take care of session management.
377 QString const key = "view-" + QString::number(id());
379 QPoint pos = settings.value(key + "/pos", QPoint(50, 50)).toPoint();
380 QSize size = settings.value(key + "/size", QSize(690, 510)).toSize();
384 if (!restoreGeometry(settings.value(key + "/geometry").toByteArray()))
385 setGeometry(50, 50, 690, 510);
387 setIconSize(settings.value(key + "/icon_size").toSize());
391 void GuiView::showEvent(QShowEvent * e)
393 LYXERR(Debug::GUI, "Passed Geometry "
394 << size().height() << "x" << size().width()
395 << "+" << pos().x() << "+" << pos().y());
397 if (d.splitter_->count() == 0)
398 // No work area, switch to the background widget.
401 QMainWindow::showEvent(e);
405 void GuiView::closeEvent(QCloseEvent * close_event)
407 // we may have been called through the close window button
408 // which bypasses the LFUN machinery.
409 if (!quitting_by_menu_ && theApp()->gui().viewIds().size() == 1) {
410 if (!theBufferList().quitWriteAll()) {
411 close_event->ignore();
416 // Make sure that no LFUN use this close to be closed View.
417 theLyXFunc().setLyXView(0);
418 // Make sure the timer time out will not trigger a statusbar update.
419 statusbar_timer_.stop();
421 if (lyxrc.allow_geometry_session) {
423 QString const key = "view-" + QString::number(id());
425 settings.setValue(key + "/pos", pos());
426 settings.setValue(key + "/size", size());
428 settings.setValue(key + "/geometry", saveGeometry());
430 settings.setValue(key + "/icon_size", iconSize());
431 d.toolbars_->saveToolbarInfo();
434 theApp()->gui().unregisterView(id());
435 if (!theApp()->gui().viewIds().empty()) {
436 // Just close the window and do nothing else if this is not the
438 close_event->accept();
444 // this is the place where we leave the frontend.
445 // it is the only point at which we start quitting.
446 close_event->accept();
447 // quit the event loop
452 void GuiView::dragEnterEvent(QDragEnterEvent * event)
454 if (event->mimeData()->hasUrls())
456 /// \todo Ask lyx-devel is this is enough:
457 /// if (event->mimeData()->hasFormat("text/plain"))
458 /// event->acceptProposedAction();
462 void GuiView::dropEvent(QDropEvent* event)
464 QList<QUrl> files = event->mimeData()->urls();
468 LYXERR(Debug::GUI, BOOST_CURRENT_FUNCTION << " got URLs!");
469 for (int i = 0; i != files.size(); ++i) {
470 string const file = support::os::internal_path(fromqstr(
471 files.at(i).toLocalFile()));
473 dispatch(FuncRequest(LFUN_FILE_OPEN, file));
478 void GuiView::message(docstring const & str)
480 statusBar()->showMessage(toqstr(str));
481 statusbar_timer_.stop();
482 statusbar_timer_.start(statusbar_timer_value);
486 void GuiView::smallSizedIcons()
488 setIconSize(QSize(d.smallIconSize, d.smallIconSize));
492 void GuiView::normalSizedIcons()
494 setIconSize(QSize(d.normalIconSize, d.normalIconSize));
498 void GuiView::bigSizedIcons()
500 setIconSize(QSize(d.bigIconSize, d.bigIconSize));
504 void GuiView::clearMessage()
508 theLyXFunc().setLyXView(this);
509 statusBar()->showMessage(toqstr(theLyXFunc().viewStatusMessage()));
510 statusbar_timer_.stop();
514 void GuiView::updateWindowTitle(GuiWorkArea * wa)
516 if (wa != d.current_work_area_)
518 setWindowTitle(qt_("LyX: ") + wa->windowTitle());
519 setWindowIconText(wa->windowIconText());
523 void GuiView::on_currentWorkAreaChanged(GuiWorkArea * wa)
526 disconnectBufferView();
527 connectBufferView(wa->bufferView());
528 connectBuffer(wa->bufferView().buffer());
529 d.current_work_area_ = wa;
530 QObject::connect(wa, SIGNAL(titleChanged(GuiWorkArea *)),
531 this, SLOT(updateWindowTitle(GuiWorkArea *)));
532 updateWindowTitle(wa);
535 // Buffer-dependent dialogs should be updated or
536 // hidden. This should go here because some dialogs (eg ToC)
537 // require bv_->text.
538 dialogs_->updateBufferDependent(true);
540 updateLayoutChoice(false);
545 void GuiView::updateStatusBar()
547 // let the user see the explicit message
548 if (statusbar_timer_.isActive())
551 statusBar()->showMessage(toqstr(theLyXFunc().viewStatusMessage()));
555 bool GuiView::hasFocus() const
557 return qApp->activeWindow() == this;
561 bool GuiView::event(QEvent * e)
565 // Useful debug code:
566 //case QEvent::ActivationChange:
567 //case QEvent::WindowDeactivate:
568 //case QEvent::Paint:
569 //case QEvent::Enter:
570 //case QEvent::Leave:
571 //case QEvent::HoverEnter:
572 //case QEvent::HoverLeave:
573 //case QEvent::HoverMove:
574 //case QEvent::StatusTip:
575 //case QEvent::DragEnter:
576 //case QEvent::DragLeave:
580 case QEvent::WindowActivate: {
581 theApp()->setCurrentView(*this);
582 if (d.current_work_area_) {
583 BufferView & bv = d.current_work_area_->bufferView();
584 connectBufferView(bv);
585 connectBuffer(bv.buffer());
586 // The document structure, name and dialogs might have
587 // changed in another view.
588 dialogs_->updateBufferDependent(true);
590 setWindowTitle(qt_("LyX"));
591 setWindowIconText(qt_("LyX"));
593 return QMainWindow::event(e);
595 case QEvent::ShortcutOverride: {
596 QKeyEvent * ke = static_cast<QKeyEvent*>(e);
597 if (!d.current_work_area_) {
598 theLyXFunc().setLyXView(this);
600 setKeySymbol(&sym, ke);
601 theLyXFunc().processKeySym(sym, q_key_state(ke->modifiers()));
605 if (ke->key() == Qt::Key_Tab || ke->key() == Qt::Key_Backtab) {
607 setKeySymbol(&sym, ke);
608 d.current_work_area_->processKeySym(sym, NoModifier);
614 return QMainWindow::event(e);
619 bool GuiView::focusNextPrevChild(bool /*next*/)
626 void GuiView::setBusy(bool yes)
628 if (d.current_work_area_) {
629 d.current_work_area_->setUpdatesEnabled(!yes);
631 d.current_work_area_->stopBlinkingCursor();
633 d.current_work_area_->startBlinkingCursor();
637 QApplication::setOverrideCursor(Qt::WaitCursor);
639 QApplication::restoreOverrideCursor();
643 GuiToolbar * GuiView::makeToolbar(ToolbarInfo const & tbinfo, bool newline)
645 GuiToolbar * toolBar = new GuiToolbar(tbinfo, *this);
647 if (tbinfo.flags & ToolbarInfo::TOP) {
649 addToolBarBreak(Qt::TopToolBarArea);
650 addToolBar(Qt::TopToolBarArea, toolBar);
653 if (tbinfo.flags & ToolbarInfo::BOTTOM) {
654 // Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
655 #if (QT_VERSION >= 0x040202)
657 addToolBarBreak(Qt::BottomToolBarArea);
659 addToolBar(Qt::BottomToolBarArea, toolBar);
662 if (tbinfo.flags & ToolbarInfo::LEFT) {
663 // Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
664 #if (QT_VERSION >= 0x040202)
666 addToolBarBreak(Qt::LeftToolBarArea);
668 addToolBar(Qt::LeftToolBarArea, toolBar);
671 if (tbinfo.flags & ToolbarInfo::RIGHT) {
672 // Qt < 4.2.2 cannot handle ToolBarBreak on non-TOP dock.
673 #if (QT_VERSION >= 0x040202)
675 addToolBarBreak(Qt::RightToolBarArea);
677 addToolBar(Qt::RightToolBarArea, toolBar);
680 // The following does not work so I cannot restore to exact toolbar location
682 ToolbarSection::ToolbarInfo & tbinfo = LyX::ref().session().toolbars().load(tbinfo.name);
683 toolBar->move(tbinfo.posx, tbinfo.posy);
690 GuiWorkArea * GuiView::workArea(Buffer & buffer)
692 for (int i = 0; i != d.splitter_->count(); ++i) {
693 GuiWorkArea * wa = d.tabWorkArea(i)->workArea(buffer);
701 GuiWorkArea * GuiView::addWorkArea(Buffer & buffer)
703 GuiWorkArea * wa = new GuiWorkArea(buffer, *this);
704 wa->setUpdatesEnabled(false);
706 // Automatically create a TabWorkArea if there are none yet.
707 if (!d.splitter_->count())
710 TabWorkArea * tab_widget = d.currentTabWorkArea();
711 tab_widget->addTab(wa, wa->windowTitle());
712 QObject::connect(wa, SIGNAL(titleChanged(GuiWorkArea *)),
713 tab_widget, SLOT(updateTabText(GuiWorkArea *)));
715 wa->bufferView().updateMetrics();
717 // Hide tabbar if there's only one tab.
718 tab_widget->showBar(tab_widget->count() > 1);
723 void GuiView::addTabWorkArea()
725 TabWorkArea * twa = new TabWorkArea;
726 QObject::connect(twa, SIGNAL(currentWorkAreaChanged(GuiWorkArea *)),
727 this, SLOT(on_currentWorkAreaChanged(GuiWorkArea *)));
728 d.splitter_->addWidget(twa);
729 d.stack_widget_->setCurrentWidget(d.splitter_);
733 GuiWorkArea const * GuiView::currentWorkArea() const
735 return d.current_work_area_;
739 void GuiView::setCurrentWorkArea(GuiWorkArea * work_area)
741 BOOST_ASSERT(work_area);
743 // Changing work area can result from opening a file so
744 // update the toc in any case.
747 GuiWorkArea * wa = static_cast<GuiWorkArea *>(work_area);
748 d.current_work_area_ = wa;
749 for (int i = 0; i != d.splitter_->count(); ++i) {
750 if (d.tabWorkArea(i)->setCurrentWorkArea(wa))
756 void GuiView::removeWorkArea(GuiWorkArea * work_area)
758 BOOST_ASSERT(work_area);
759 GuiWorkArea * gwa = static_cast<GuiWorkArea *>(work_area);
760 if (gwa == d.current_work_area_) {
762 disconnectBufferView();
763 dialogs_->hideBufferDependent();
764 d.current_work_area_ = 0;
767 // removing a work area often results from closing a file so
768 // update the toc in any case.
771 for (int i = 0; i != d.splitter_->count(); ++i) {
772 TabWorkArea * twa = d.tabWorkArea(i);
773 if (!twa->removeWorkArea(gwa))
774 // Not found in this tab group.
777 // We found and removed the GuiWorkArea.
779 // No more WorkAreas in this tab group, so delete it.
784 if (d.current_work_area_)
785 // This means that we are not closing the current GuiWorkArea;
788 // Switch to the next GuiWorkArea in the found TabWorkArea.
789 d.current_work_area_ = twa->currentWorkArea();
793 if (d.splitter_->count() == 0)
794 // No more work area, switch to the background widget.
799 void GuiView::updateLayoutChoice(bool force)
801 // Don't show any layouts without a buffer
803 d.toolbars_->clearLayoutList();
807 // Update the layout display
808 if (d.toolbars_->updateLayoutList(buffer()->params().getTextClassPtr(), force)) {
809 d.current_layout = buffer()->params().getTextClass().defaultLayoutName();
812 docstring const & layout = d.current_work_area_->bufferView().cursor().
813 innerParagraph().layout()->name();
815 if (layout != d.current_layout) {
816 d.toolbars_->setLayout(layout);
817 d.current_layout = layout;
822 bool GuiView::isToolbarVisible(std::string const & id)
824 return d.toolbars_->visible(id);
827 void GuiView::updateToolbars()
829 if (d.current_work_area_) {
831 d.current_work_area_->bufferView().cursor().inMathed();
833 lyx::getStatus(FuncRequest(LFUN_LAYOUT_TABULAR)).enabled();
835 lyx::getStatus(FuncRequest(LFUN_CHANGES_TRACK)).enabled() &&
836 lyx::getStatus(FuncRequest(LFUN_CHANGES_TRACK)).onoff(true);
838 d.toolbars_->update(math, table, review);
840 d.toolbars_->update(false, false, false);
842 // update read-only status of open dialogs.
843 dialogs_->checkStatus();
847 Buffer * GuiView::buffer()
849 if (d.current_work_area_)
850 return &d.current_work_area_->bufferView().buffer();
855 Buffer const * GuiView::buffer() const
857 if (d.current_work_area_)
858 return &d.current_work_area_->bufferView().buffer();
863 void GuiView::setBuffer(Buffer * newBuffer)
865 BOOST_ASSERT(newBuffer);
868 GuiWorkArea * wa = workArea(*newBuffer);
870 updateLabels(*newBuffer->masterBuffer());
871 wa = addWorkArea(*newBuffer);
873 //Disconnect the old buffer...there's no new one.
876 connectBuffer(*newBuffer);
877 connectBufferView(wa->bufferView());
878 setCurrentWorkArea(wa);
884 Buffer * GuiView::loadLyXFile(FileName const & filename, bool tolastfiles)
888 Buffer * newBuffer = checkAndLoadLyXFile(filename);
891 message(_("Document not loaded."));
897 GuiWorkArea * wa = workArea(*newBuffer);
899 wa = addWorkArea(*newBuffer);
901 // scroll to the position when the file was last closed
902 if (lyxrc.use_lastfilepos) {
903 LastFilePosSection::FilePos filepos =
904 LyX::ref().session().lastFilePos().load(filename);
905 // if successfully move to pit (returned par_id is not zero),
906 // update metrics and reset font
907 wa->bufferView().moveToPosition(filepos.pit, filepos.pos, 0, 0);
911 LyX::ref().session().lastFiles().add(filename);
918 void GuiView::connectBuffer(Buffer & buf)
920 buf.setGuiDelegate(this);
924 void GuiView::disconnectBuffer()
926 if (d.current_work_area_)
927 d.current_work_area_->bufferView().setGuiDelegate(0);
931 void GuiView::connectBufferView(BufferView & bv)
933 bv.setGuiDelegate(this);
937 void GuiView::disconnectBufferView()
939 if (d.current_work_area_)
940 d.current_work_area_->bufferView().setGuiDelegate(0);
944 void GuiView::errors(string const & error_type)
946 ErrorList & el = buffer()->errorList(error_type);
948 dialogs_->show("errorlist", error_type);
952 void GuiView::showDialog(string const & name)
954 dialogs_->show(name);
958 void GuiView::showDialogWithData(string const & name, string const & data)
960 dialogs_->show(name, data);
964 void GuiView::showInsetDialog(string const & name, string const & data,
967 dialogs_->show(name, data, inset);
971 void GuiView::updateDialog(string const & name, string const & data)
973 if (dialogs_->visible(name))
974 dialogs_->update(name, data);
978 BufferView * GuiView::view()
980 return d.current_work_area_ ? &d.current_work_area_->bufferView() : 0;
984 void GuiView::updateToc()
986 updateDialog("toc", "");
990 void GuiView::updateEmbeddedFiles()
992 updateDialog("embedding", "");
996 void GuiView::autoSave()
998 LYXERR(Debug::INFO, "Running autoSave()");
1001 view()->buffer().autoSave();
1005 void GuiView::resetAutosaveTimers()
1008 autosave_timeout_->restart();
1012 void GuiView::dispatch(FuncRequest const & cmd)
1014 switch(cmd.action) {
1015 case LFUN_BUFFER_SWITCH:
1016 setBuffer(theBufferList().getBuffer(to_utf8(cmd.argument())));
1019 case LFUN_COMMAND_EXECUTE: {
1020 bool const show_it = cmd.argument() != "off";
1021 d.toolbars_->showCommandBuffer(show_it);
1024 case LFUN_DROP_LAYOUTS_CHOICE:
1025 d.toolbars_->openLayoutList();
1028 case LFUN_MENU_OPEN:
1029 d.menubar_->openByName(toqstr(cmd.argument()));
1032 case LFUN_TOOLBAR_TOGGLE: {
1033 string const name = cmd.getArg(0);
1034 bool const allowauto = cmd.getArg(1) == "allowauto";
1035 // it is possible to get current toolbar status like this,...
1036 // but I decide to obey the order of ToolbarBackend::flags
1037 // and disregard real toolbar status.
1038 // toolbars_->saveToolbarInfo();
1040 // toggle state on/off/auto
1041 d.toolbars_->toggleToolbarState(name, allowauto);
1045 ToolbarInfo * tbi = d.toolbars_->getToolbarInfo(name);
1047 message(bformat(_("Unknown toolbar \"%1$s\""), from_utf8(name)));
1051 if (tbi->flags & ToolbarInfo::ON)
1053 else if (tbi->flags & ToolbarInfo::OFF)
1055 else if (tbi->flags & ToolbarInfo::AUTO)
1058 message(bformat(_("Toolbar \"%1$s\" state set to %2$s"),
1059 _(tbi->gui_name), state));
1064 theLyXFunc().setLyXView(this);
1070 Buffer const * GuiView::updateInset(Inset const * inset)
1072 if (!d.current_work_area_)
1076 d.current_work_area_->scheduleRedraw();
1078 return &d.current_work_area_->bufferView().buffer();
1082 void GuiView::restartCursor()
1084 /* When we move around, or type, it's nice to be able to see
1085 * the cursor immediately after the keypress.
1087 if (d.current_work_area_)
1088 d.current_work_area_->startBlinkingCursor();
1091 } // namespace frontend
1094 #include "GuiView_moc.cpp"