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
This commit is contained in:
Abdelrazak Younes 2008-02-09 17:54:28 +00:00
parent cc65d1f74d
commit 1ff60667a6
2 changed files with 62 additions and 43 deletions

View File

@ -1800,50 +1800,9 @@ bool GuiView::dispatch(FuncRequest const & cmd)
break; break;
} }
case LFUN_UI_TOGGLE: { case LFUN_UI_TOGGLE:
string const arg = cmd.getArg(0); lfunUiToggle(cmd);
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();
}
}
break; break;
}
default: default:
return false; 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) Buffer const * GuiView::updateInset(Inset const * inset)
{ {
if (!d.current_work_area_) if (!d.current_work_area_)

View File

@ -246,6 +246,9 @@ public:
void disconnectDialog(std::string const & name); void disconnectDialog(std::string const & name);
private: private:
///
void lfunUiToggle(FuncRequest const & cmd);
/// ///
void insertLyXFile(docstring const & fname); void insertLyXFile(docstring const & fname);
/// ///