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)
|
2009-05-14 23:46:42 +00:00
|
|
|
: DockView(parent, "toc", qt_("Outline"), area, flags), is_closing_(false)
|
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_);
|
2010-04-26 10:03:09 +00:00
|
|
|
setFocusProxy(widget_);
|
2007-10-08 20:14:58 +00:00
|
|
|
}
|
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-10-23 20:46:03 +00:00
|
|
|
widget_->updateView();
|
|
|
|
return;
|
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)
|
2008-06-17 15:44:14 +00:00
|
|
|
// In the opposite case, updateView() will be called anyway.
|
|
|
|
widget_->updateView();
|
2007-10-07 18:58:47 +00:00
|
|
|
}
|
|
|
|
|
2009-05-14 23:46:42 +00:00
|
|
|
|
2009-06-09 13:17:07 +00:00
|
|
|
void GuiToc::closeEvent(QCloseEvent * /*event*/)
|
2009-05-14 23:46:42 +00:00
|
|
|
{
|
|
|
|
is_closing_ = true;
|
|
|
|
((GuiView *)parent())->updateToolbars();
|
|
|
|
is_closing_ = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-04-08 21:06:58 +00:00
|
|
|
void GuiToc::doDispatch(Cursor & cur, FuncRequest const & cmd)
|
|
|
|
{
|
|
|
|
widget_->doDispatch(cur, cmd);
|
|
|
|
}
|
|
|
|
|
2007-10-07 18:58:47 +00:00
|
|
|
|
2009-04-11 11:43:13 +00:00
|
|
|
bool GuiToc::getStatus(Cursor & cur, FuncRequest const & cmd,
|
|
|
|
FuncStatus & status) const
|
|
|
|
{
|
|
|
|
return widget_->getStatus(cur, cmd, status);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-11-23 09:44:02 +00:00
|
|
|
Dialog * createGuiToc(GuiView & lv)
|
2007-10-06 20:35:44 +00:00
|
|
|
{
|
2010-03-11 19:33:08 +00:00
|
|
|
GuiToc * toc;
|
2007-10-06 20:35:44 +00:00
|
|
|
#ifdef Q_WS_MACX
|
2010-03-11 19:33:08 +00:00
|
|
|
// On Mac show at the right and floating
|
|
|
|
toc = new GuiToc(lv, Qt::RightDockWidgetArea);
|
|
|
|
toc->setFloating(true);
|
2007-10-06 20:35:44 +00:00
|
|
|
#else
|
2010-03-11 19:33:08 +00:00
|
|
|
toc = new GuiToc(lv);
|
2007-10-06 20:35:44 +00:00
|
|
|
#endif
|
2010-03-11 19:33:08 +00:00
|
|
|
return toc;
|
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
|
|
|
|
2008-11-14 14:28:50 +00:00
|
|
|
#include "moc_GuiToc.cpp"
|