mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-11 21:49:51 +00:00
5a4d33d97e
The Toc dialog is not finished yet, there's some clean-up to do especially in select_adapdator which doesn't seem to work. This makes lyx crash when clicking on the Up, Down, In or Out buttons. * frontends/qt4/QTocDialog.[Ch]: add automatic slots * frontends/qt4/QTocDialog.[Ch]: add "enableButtons(bool)" * frontends/qt4/ui/QTocUi.ui: add pushbuttons * frontends/qt4/QToc.[Ch]: add move* methods. The following Qt4 equivalent changes to revision r13521 are not done yet: * frontends/qt2/QToc.[Ch]: add move* method. (QToc::updateToc): (QToc::select): add code for TOC window positioning, and outlining methods git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13530 a592a061-630c-0410-9148-cb99ea01b6c8
103 lines
1.6 KiB
C
103 lines
1.6 KiB
C
/**
|
|
* \file QToc.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author John Levon
|
|
* \author Abdelrazak Younes
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "QToc.h"
|
|
#include "QTocDialog.h"
|
|
#include "Qt2BC.h"
|
|
#include "qt_helpers.h"
|
|
|
|
#include "debug.h"
|
|
|
|
#include "controllers/ControlToc.h"
|
|
|
|
using std::endl;
|
|
|
|
using std::pair;
|
|
using std::vector;
|
|
using std::string;
|
|
|
|
namespace lyx {
|
|
namespace frontend {
|
|
|
|
typedef QController<ControlToc, QView<QTocDialog> > base_class;
|
|
|
|
QToc::QToc(Dialog & parent)
|
|
: base_class(parent, _("Table of Contents"))
|
|
{}
|
|
|
|
|
|
void QToc::build_dialog()
|
|
{
|
|
dialog_.reset(new QTocDialog(this));
|
|
|
|
// Manage the cancel/close button
|
|
bcview().setCancel(dialog_->closePB);
|
|
}
|
|
|
|
|
|
void QToc::update_contents()
|
|
{
|
|
dialog_->updateType();
|
|
dialog_->updateToc();
|
|
}
|
|
|
|
|
|
void QToc::select(string const & text)
|
|
{
|
|
toc::Toc::const_iterator iter = toclist.begin();
|
|
|
|
for (; iter != toclist.end(); ++iter) {
|
|
if (iter->str == text)
|
|
break;
|
|
}
|
|
|
|
if (iter == toclist.end()) {
|
|
lyxerr[Debug::GUI] << "Couldn't find highlighted TOC entry: "
|
|
<< text << endl;
|
|
return;
|
|
}
|
|
|
|
controller().goTo(*iter);
|
|
}
|
|
|
|
void QToc::moveUp()
|
|
{
|
|
controller().outline(toc::UP);
|
|
update_contents();
|
|
}
|
|
|
|
|
|
void QToc::moveDown()
|
|
{
|
|
controller().outline(toc::DOWN);
|
|
update_contents();
|
|
}
|
|
|
|
|
|
void QToc::moveIn()
|
|
{
|
|
controller().outline(toc::IN);
|
|
update_contents();
|
|
}
|
|
|
|
|
|
void QToc::moveOut()
|
|
{
|
|
controller().outline(toc::OUT);
|
|
update_contents();
|
|
}
|
|
|
|
|
|
} // namespace frontend
|
|
} // namespace lyx
|