2006-03-05 17:24:44 +00:00
|
|
|
/**
|
2007-08-31 05:53:55 +00:00
|
|
|
* \file GuiToc.cpp
|
2006-03-05 17:24:44 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
* \author Abdelrazak Younes
|
2007-10-06 20:35:44 +00:00
|
|
|
* \author Angus Leeming
|
2006-03-05 17:24:44 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiToc.h"
|
2007-10-06 20:35:44 +00:00
|
|
|
#include "GuiView.h"
|
|
|
|
#include "DockView.h"
|
|
|
|
#include "TocWidget.h"
|
2006-03-05 17:24:44 +00:00
|
|
|
#include "qt_helpers.h"
|
|
|
|
|
2007-10-06 20:35:44 +00:00
|
|
|
#include "Buffer.h"
|
|
|
|
#include "BufferView.h"
|
|
|
|
#include "BufferParams.h"
|
|
|
|
#include "FuncRequest.h"
|
|
|
|
|
2008-02-18 07:14:42 +00:00
|
|
|
#include "support/debug.h"
|
|
|
|
#include "support/gettext.h"
|
2008-04-30 08:26:40 +00:00
|
|
|
#include "support/lassert.h"
|
2008-03-15 00:22:54 +00:00
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
using namespace std;
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
namespace frontend {
|
|
|
|
|
2007-11-05 13:52:37 +00:00
|
|
|
GuiToc::GuiToc(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
|
2008-02-12 07:47:16 +00:00
|
|
|
: DockView(parent, "toc", qt_("Outline"), area, flags)
|
2007-10-08 20:14:58 +00:00
|
|
|
{
|
2008-05-30 11:33:24 +00:00
|
|
|
widget_ = new TocWidget(parent, this);
|
2007-10-08 20:14:58 +00:00
|
|
|
setWidget(widget_);
|
|
|
|
}
|
2006-03-05 17:24:44 +00:00
|
|
|
|
|
|
|
|
2007-10-09 09:29:27 +00:00
|
|
|
GuiToc::~GuiToc()
|
|
|
|
{
|
|
|
|
delete widget_;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-10-06 20:35:44 +00:00
|
|
|
void GuiToc::updateView()
|
|
|
|
{
|
2008-06-09 07:09:29 +00:00
|
|
|
#ifndef Q_WS_MACX
|
|
|
|
widget_->updateView();
|
|
|
|
return;
|
|
|
|
#endif
|
|
|
|
|
2008-06-09 22:25:51 +00:00
|
|
|
widget_->updateView();
|
2008-06-09 07:09:29 +00:00
|
|
|
// Special code for Mac drawer.
|
|
|
|
if (windowFlags() & Qt::Drawer && lyxview().isFullScreen()) {
|
|
|
|
setWindowFlags(Qt::Widget);
|
|
|
|
setFeatures(DockWidgetClosable);
|
2008-06-09 22:25:51 +00:00
|
|
|
// Setting features hides the dialog, see Qt's doc.
|
2008-06-09 07:09:29 +00:00
|
|
|
show();
|
2008-06-09 16:11:47 +00:00
|
|
|
} else if (!(windowFlags() & Qt::Drawer)) {
|
2008-06-09 07:09:29 +00:00
|
|
|
setWindowFlags(Qt::Drawer);
|
|
|
|
setFeatures(NoDockWidgetFeatures);
|
2008-06-09 16:11:47 +00:00
|
|
|
// Setting features hides the dialog, see Qt's doc.
|
2008-06-09 07:09:29 +00:00
|
|
|
show();
|
|
|
|
}
|
2007-10-06 20:35:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool GuiToc::initialiseParams(string const & data)
|
2007-04-03 13:07:38 +00:00
|
|
|
{
|
2008-05-02 12:09:51 +00:00
|
|
|
widget_->init(toqstr(data));
|
2007-04-03 13:07:38 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-02 12:09:51 +00:00
|
|
|
void GuiToc::dispatchParams()
|
2007-10-06 20:35:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-02 12:09:51 +00:00
|
|
|
void GuiToc::enableView(bool enable)
|
2007-10-07 18:58:47 +00:00
|
|
|
{
|
2008-06-17 15:10:03 +00:00
|
|
|
if (!enable)
|
|
|
|
widget_->init(QString());
|
2007-10-07 18:58:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
Dialog * createGuiToc(GuiView & lv)
|
2007-10-06 20:35:44 +00:00
|
|
|
{
|
2007-11-05 13:52:37 +00:00
|
|
|
GuiView & guiview = static_cast<GuiView &>(lv);
|
2007-10-06 20:35:44 +00:00
|
|
|
#ifdef Q_WS_MACX
|
|
|
|
// On Mac show as a drawer at the right
|
2007-10-08 20:14:58 +00:00
|
|
|
return new GuiToc(guiview, Qt::RightDockWidgetArea, Qt::Drawer);
|
2007-10-06 20:35:44 +00:00
|
|
|
#else
|
2007-10-08 20:14:58 +00:00
|
|
|
return new GuiToc(guiview);
|
2007-10-06 20:35:44 +00:00
|
|
|
#endif
|
2006-03-29 16:57:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-03-05 17:24:44 +00:00
|
|
|
} // namespace frontend
|
|
|
|
} // namespace lyx
|
2007-03-12 14:23:44 +00:00
|
|
|
|
2007-08-31 05:53:55 +00:00
|
|
|
#include "GuiToc_moc.cpp"
|