#include "TocWidget.h"
-#include "TocModel.h"
+#include "GuiView.h"
#include "qt_helpers.h"
+#include "TocModel.h"
#include "FuncRequest.h"
#include "LyXFunc.h"
namespace lyx {
namespace frontend {
-TocWidget::TocWidget(TocModels & models, QWidget * parent)
- : QWidget(parent), depth_(0), models_(models)
+TocWidget::TocWidget(GuiView & gui_view, QWidget * parent)
+ : QWidget(parent), depth_(0), gui_view_(gui_view)
{
setupUi(this);
void TocWidget::on_tocTV_clicked(QModelIndex const & index)
{
goTo(index);
- // FIXME: It would be nice to return the focus to the work area in this
- // case. But we need access to the GuiView!
+ gui_view_.setFocus();
}
LYXERR(Debug::GUI, "goto " << index.row()
<< ", " << index.column());
- models_.goTo(typeCO->currentIndex(), index);
+ gui_view_.tocModels().goTo(typeCO->currentIndex(), index);
}
// The backend update can take some time so we disable
// the controls while waiting.
enableControls(false);
- models_.updateBackend();
+ gui_view_.tocModels().updateBackend();
}
/* FIXME (Ugras 17/11/06):
}
}
+
void TocWidget::on_typeCO_currentIndexChanged(int value)
{
setTocModel(value);
{
updateTB->setEnabled(enable);
- if (!models_.canOutline(typeCO->currentIndex()))
+ if (!gui_view_.tocModels().canOutline(typeCO->currentIndex()))
enable = false;
moveUpTB->setEnabled(enable);
{
LYXERR(Debug::GUI, "In TocWidget::updateView()");
setTreeDepth(depth_);
- select(models_.currentIndex(typeCO->currentIndex()));
+ select(gui_view_.tocModels().currentIndex(typeCO->currentIndex()));
}
void TocWidget::init(QString const & str)
{
- QStringList const & type_names = models_.typeNames();
+ QStringList const & type_names = gui_view_.tocModels().typeNames();
if (type_names.isEmpty()) {
enableControls(false);
typeCO->clear();
return;
}
- int selected_type = models_.decodeType(str);
+ int selected_type = gui_view_.tocModels().decodeType(str);
QString const current_text = typeCO->currentText();
typeCO->blockSignals(true);
void TocWidget::setTocModel(size_t type)
{
bool controls_enabled = false;
- QStandardItemModel * toc_model = models_.model(type);
+ QStandardItemModel * toc_model = gui_view_.tocModels().model(type);
if (toc_model) {
controls_enabled = toc_model->rowCount() > 0;
tocTV->setModel(toc_model);
enableControls(controls_enabled);
if (controls_enabled) {
- depthSL->setMaximum(models_.depth(type));
+ depthSL->setMaximum(gui_view_.tocModels().depth(type));
depthSL->setValue(depth_);
}