X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiView.cpp;h=63bd54ec63c476087b971512b96e55f65fe1eb06;hb=d2a96bcdc369b52ae6fb52c5a612bcd9f665231b;hp=e4ff6ccb2083a6c2a97ff81be434608fafef5ce6;hpb=a04284c2b8f3e89c919a59cb9eead7419fd7801e;p=lyx.git diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index e4ff6ccb20..63bd54ec63 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -403,8 +403,8 @@ void GuiView::closeEvent(QCloseEvent * close_event) continue; } - std::vector const & ids = guiApp->viewIds(); - for (size_type i = 0; i != ids.size(); ++i) { + QVector const ids = guiApp->viewIds(); + for (int i = 0; i != ids.size(); ++i) { if (id_ == ids[i]) continue; if (guiApp->view(ids[i]).workArea(*b)) { @@ -550,6 +550,9 @@ void GuiView::on_currentWorkAreaChanged(GuiWorkArea * wa) structureChanged(); + // The document settings needs to be reinitialised. + updateDialog("document", ""); + // Buffer-dependent dialogs must be updated. This is done here because // some dialogs require buffer()->text. updateDialogs(); @@ -570,6 +573,8 @@ void GuiView::on_lastWorkAreaRemoved() } #else structureChanged(); + // The document settings needs to be reinitialised. + updateDialog("document", ""); updateDialogs(); #endif } @@ -624,6 +629,8 @@ bool GuiView::event(QEvent * e) // The document structure, name and dialogs might have // changed in another view. structureChanged(); + // The document settings needs to be reinitialised. + updateDialog("document", ""); updateDialogs(); } else { setWindowTitle(qt_("LyX")); @@ -634,12 +641,23 @@ bool GuiView::event(QEvent * e) } case QEvent::ShortcutOverride: { + + if (isFullScreen() && menuBar()->isHidden()) { + QKeyEvent * ke = static_cast(e); + // FIXME: we should also try to detect special LyX shortcut such as + // Alt-P and Alt-M. Right now there is a hack in + // GuiWorkArea::processKeySym() that hides again the menubar for + // those cases. + if (ke->modifiers() & Qt::AltModifier && ke->key() != Qt::Key_Alt) + menuBar()->show(); + return QMainWindow::event(e); + } + if (d.current_work_area_) // Nothing special to do. return QMainWindow::event(e); QKeyEvent * ke = static_cast(e); - // Let Qt handle menu access and the Tab keys to navigate keys to navigate // between controls. if (ke->modifiers() & Qt::AltModifier || ke->key() == Qt::Key_Tab @@ -927,8 +945,6 @@ void GuiView::structureChanged() // Navigator needs more than a simple update in this case. It needs to be // rebuilt. updateDialog("toc", ""); - // Same for the document settings dialog. - updateDialog("document", ""); } @@ -969,9 +985,8 @@ void GuiView::resetAutosaveTimers() } -FuncStatus GuiView::getStatus(FuncRequest const & cmd) +bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag) { - FuncStatus flag; bool enable = true; Buffer * buf = buffer(); @@ -1061,10 +1076,6 @@ FuncStatus GuiView::getStatus(FuncRequest const & cmd) } case LFUN_INSET_APPLY: { - if (!buf) { - enable = false; - break; - } string const name = cmd.getArg(0); Inset * inset = getOpenInset(name); if (inset) { @@ -1077,7 +1088,7 @@ FuncStatus GuiView::getStatus(FuncRequest const & cmd) flag |= fs; } else { FuncRequest fr(LFUN_INSET_INSERT, cmd.argument()); - flag |= getStatus(fr); + flag |= lyx::getStatus(fr); } enable = flag.enabled(); break; @@ -1102,16 +1113,13 @@ FuncStatus GuiView::getStatus(FuncRequest const & cmd) break; default: - if (!view()) { - enable = false; - break; - } + return false; } if (!enable) flag.enabled(false); - return flag; + return true; } @@ -1665,10 +1673,11 @@ bool GuiView::closeBuffer(Buffer & buf, bool tolastopened) bool GuiView::dispatch(FuncRequest const & cmd) { - BufferView * bv = view(); + BufferView * bv = view(); // By default we won't need any update. if (bv) bv->cursor().updateFlags(Update::None); + bool dispatched = true; switch(cmd.action) { case LFUN_BUFFER_IMPORT: @@ -1839,6 +1848,7 @@ bool GuiView::dispatch(FuncRequest const & cmd) } case LFUN_INSET_APPLY: { + view()->cursor().recordUndoFullDocument(); string const name = cmd.getArg(0); Inset * inset = getOpenInset(name); if (inset) { @@ -1897,10 +1907,18 @@ bool GuiView::dispatch(FuncRequest const & cmd) break; default: - return false; + dispatched = false; + break; } - return true; + if (isFullScreen()) { + if (menuBar()->isVisible()) + menuBar()->hide(); + if (statusBar()->isVisible()) + statusBar()->hide(); + } + + return dispatched; }