From 1ff60667a639c81afa4f06e34dfd5ab2426df184 Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Sat, 9 Feb 2008 17:54:28 +0000 Subject: [PATCH] Put LFUN_UI_TOGGLE in its own method and add FIXMEs WRT multple workareas. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22901 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/qt4/GuiView.cpp | 102 ++++++++++++++++++++-------------- src/frontends/qt4/GuiView.h | 3 + 2 files changed, 62 insertions(+), 43 deletions(-) diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index e858b95ca9..fc0eeb5f86 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1800,50 +1800,9 @@ bool GuiView::dispatch(FuncRequest const & cmd) break; } - case LFUN_UI_TOGGLE: { - string const arg = cmd.getArg(0); - if (arg == "statusbar") - statusBar()->setVisible(!statusBar()->isVisible()); - else if (arg == "menubar") - menuBar()->setVisible(!menuBar()->isVisible()); -#if QT_VERSION >= 0x040300 - else if (arg == "frame") { - int l, t, r, b; - getContentsMargins(&l, &t, &r, &b); - //are the frames in default state? - if (l == 0) { - d.current_work_area_->setFrameStyle(QFrame::NoFrame); - setContentsMargins(-2, -2, -2, -2); - } else { - d.current_work_area_->setFrameStyle(QFrame::NoFrame); - setContentsMargins(0, 0, 0, 0); - } - } -#endif - else if (arg == "fullscreen") { - if (isFullScreen()) { - showNormal(); -#if QT_VERSION >= 0x040300 - setContentsMargins(0, 0, 0, 0); -#endif - d.current_work_area_->setFrameStyle(QFrame::NoFrame); - d.current_work_area_->bufferView().setFullScreen(false); - menuBar()->show(); - statusBar()->show(); - } else { - statusBar()->hide(); - menuBar()->hide(); - d.current_work_area_->setFrameStyle(QFrame::NoFrame); - d.current_work_area_->bufferView().setFullScreen(true); -#if QT_VERSION >= 0x040300 - setContentsMargins(-2, -2, -2, -2); -#endif - showFullScreen(); - } - } - + case LFUN_UI_TOGGLE: + lfunUiToggle(cmd); break; - } default: return false; @@ -1853,6 +1812,63 @@ bool GuiView::dispatch(FuncRequest const & cmd) } +void GuiView::lfunUiToggle(FuncRequest const & cmd) +{ + string const arg = cmd.getArg(0); + if (arg == "statusbar") { + statusBar()->setVisible(!statusBar()->isVisible()); + return; + } + if (arg == "menubar") { + menuBar()->setVisible(!menuBar()->isVisible()); + return; + } +#if QT_VERSION >= 0x040300 + if (arg == "frame") { + int l, t, r, b; + getContentsMargins(&l, &t, &r, &b); + //are the frames in default state? + if (l == 0) { + d.current_work_area_->setFrameStyle(QFrame::NoFrame); + setContentsMargins(-2, -2, -2, -2); + } else { + d.current_work_area_->setFrameStyle(QFrame::NoFrame); + setContentsMargins(0, 0, 0, 0); + } + return; + } +#endif + if (arg != "fullscreen") { + message(bformat(_("LFUN_UI_TOGGLE %1$s unknown command!"), arg)); + return; + } + + if (isFullScreen()) { + showNormal(); +#if QT_VERSION >= 0x040300 + setContentsMargins(0, 0, 0, 0); +#endif + // FIXME: it is not enough to take care of the current work area. + // All work areas are affected by a full screen mode! + d.current_work_area_->setFrameStyle(QFrame::NoFrame); + d.current_work_area_->bufferView().setFullScreen(false); + menuBar()->show(); + statusBar()->show(); + } else { + statusBar()->hide(); + menuBar()->hide(); + // FIXME: it is not enough to take care of the current work area. + // All work areas are affected by a full screen mode! + d.current_work_area_->setFrameStyle(QFrame::NoFrame); + d.current_work_area_->bufferView().setFullScreen(true); +#if QT_VERSION >= 0x040300 + setContentsMargins(-2, -2, -2, -2); +#endif + showFullScreen(); + } +} + + Buffer const * GuiView::updateInset(Inset const * inset) { if (!d.current_work_area_) diff --git a/src/frontends/qt4/GuiView.h b/src/frontends/qt4/GuiView.h index 6a4235b15e..c2a75b49a2 100644 --- a/src/frontends/qt4/GuiView.h +++ b/src/frontends/qt4/GuiView.h @@ -246,6 +246,9 @@ public: void disconnectDialog(std::string const & name); private: + /// + void lfunUiToggle(FuncRequest const & cmd); + /// void insertLyXFile(docstring const & fname); ///