diff --git a/src/LyXAction.cpp b/src/LyXAction.cpp index a07fd70dba..251d3c3503 100644 --- a/src/LyXAction.cpp +++ b/src/LyXAction.cpp @@ -1104,23 +1104,19 @@ void LyXAction::init() { LFUN_TOOLBAR_TOGGLE, "toolbar-toggle", NoBuffer, Buffer }, { LFUN_MENU_OPEN, "menu-open", NoBuffer, Buffer }, /*! - * \var lyx::kb_action lyx::LFUN_MENUBAR_TOGGLE - * \li Action: Toggles visibility of the main menu. - * \li Notion: This can be used for the fullscreen mode. - * \li Syntax: menubar-toggle - * \li Origin: ps, 6 Feb 2008 + * \var lyx::kb_action lyx::LFUN_UI_TOGGLE + * \li Action: Various UI visibility-toggling actions. + * \li Syntax: ui-toggle + * \li Params: statusbar : Toggle visibility of the statusbar.\n + menubar : Toggle visibility of the menubar.\n + frame : Toggle visibility of the frames around editing window.\n + fullscreen : Toggle fullscreen mode. This also covers calling the + previous functions. However #LFUN_TOOLBAR_TOGGLE for the + custom tweaks of the toolbars should be used. + * \li Origin: ps, 9 Feb 2007 * \endvar */ - { LFUN_MENUBAR_TOGGLE, "menubar-toggle", NoBuffer, Buffer }, -/*! - * \var lyx::kb_action lyx::LFUN_STATUSBAR_TOGGLE - * \li Action: Toggles visibility of the main menu. - * \li Notion: This can be used for the fullscreen mode. - * \li Syntax: statusbar-toggle - * \li Origin: ps, 6 Feb 2008 - * \endvar - */ - { LFUN_STATUSBAR_TOGGLE, "statusbar-toggle", NoBuffer, Buffer }, + { LFUN_UI_TOGGLE, "ui-toggle", NoBuffer, Buffer }, { LFUN_WINDOW_NEW, "window-new", NoBuffer, Buffer }, { LFUN_WINDOW_CLOSE, "window-close", NoBuffer, Buffer }, diff --git a/src/LyXFunc.cpp b/src/LyXFunc.cpp index 82b6c244dc..1cb8870a3d 100644 --- a/src/LyXFunc.cpp +++ b/src/LyXFunc.cpp @@ -453,8 +453,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const break; case LFUN_TOOLBAR_TOGGLE: - case LFUN_MENUBAR_TOGGLE: - case LFUN_STATUSBAR_TOGGLE: + case LFUN_UI_TOGGLE: case LFUN_INSET_APPLY: case LFUN_BUFFER_WRITE: case LFUN_BUFFER_WRITE_AS: diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 8004133a63..746f775e99 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -1800,13 +1800,48 @@ bool GuiView::dispatch(FuncRequest const & cmd) break; } - case LFUN_MENUBAR_TOGGLE: - menuBar()->setVisible(!menuBar()->isVisible()); - 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); + menuBar()->show(); + statusBar()->show(); + } else { + statusBar()->hide(); + menuBar()->hide(); + d.current_work_area_->setFrameStyle(QFrame::NoFrame); +#if QT_VERSION >= 0x040300 + setContentsMargins(-2, -2, -2, -2); +#endif + showFullScreen(); + } + } - case LFUN_STATUSBAR_TOGGLE: - statusBar()->setVisible(!statusBar()->isVisible()); break; + } default: return false; diff --git a/src/lfuns.h b/src/lfuns.h index cfde9bb545..31331d1b08 100644 --- a/src/lfuns.h +++ b/src/lfuns.h @@ -413,9 +413,7 @@ enum kb_action { LFUN_MATH_MACRO_ADD_GREEDY_OPTIONAL_PARAM, LFUN_IN_MATHMACROTEMPLATE, LFUN_SCROLL, - LFUN_MENUBAR_TOGGLE, - LFUN_STATUSBAR_TOGGLE, - // 320 + LFUN_UI_TOGGLE, LFUN_LASTACTION // end of the table };