namespace frontend {
-GuiToc::GuiToc(LyXView & lv)
- : GuiDialog(lv, "toc")
+GuiToc::GuiToc(Dialog & dialog)
+ : ControlToc(dialog)
{
- setViewTitle(_("Outline"));
- setController(new ControlToc(*this));
#ifdef Q_WS_MACX
// On Mac show as a drawer at the right
//setView(new DockView<GuiToc, TocWidget>(
//setView(new DockView<GuiToc, TocWidget>(
// *dialog, qtoc, &gui_view, _("Outline")));
#endif
- bc().setPolicy(ButtonPolicy::OkCancelPolicy);
-}
-
-
-ControlToc & GuiToc::controller() const
-{
- return static_cast<ControlToc &>(Dialog::controller());
}
if (type < 0)
return false;
- return controller().canOutline(type);
+ return canOutline(type);
}
if(!canOutline(type))
return QModelIndex();
- return toc_models_[type]->modelIndex(controller().getCurrentTocItem(type));
+ return toc_models_[type]->modelIndex(getCurrentTocItem(type));
}
LYXERR(Debug::GUI) << "GuiToc::goTo " << to_utf8(it->str()) << endl;
- controller().goTo(*it);
+ ControlToc::goTo(*it);
}
bool GuiToc::initialiseParams(std::string const & data)
{
- if (!controller().initialiseParams(data))
+ if (!ControlToc::initialiseParams(data))
return false;
updateView();
modelReset();
void GuiToc::updateView()
{
toc_models_.clear();
- TocList::const_iterator it = controller().tocs().begin();
- TocList::const_iterator end = controller().tocs().end();
+ TocList::const_iterator it = tocs().begin();
+ TocList::const_iterator end = tocs().end();
for (; it != end; ++it)
toc_models_.push_back(new TocModel(it->second));
}
namespace frontend {
-TocWidget::TocWidget(GuiToc * form, QWidget * parent)
- : QWidget(parent), depth_(0)
+TocWidget::TocWidget(GuiToc & form, QWidget * parent)
+ : QWidget(parent), depth_(0), form_(form)
{
setupUi(this);
- form_ = form;
+ setWindowTitle(qt_("Outline"));
- connect(form_, SIGNAL(modelReset()), SLOT(updateGui()));
+ connect(&form_, SIGNAL(modelReset()), SLOT(updateGui()));
FileName icon_path = libFileSearch("images", "promote.png");
moveOutTB->setIcon(QIcon(toqstr(icon_path.absFilename())));
<< ", " << current.column()
<< endl;
- form_->goTo(typeCO->currentIndex(), current);
+ form_.goTo(typeCO->currentIndex(), current);
}
// The backend update can take some time so we disable
// the controls while waiting.
enableControls(false);
- form_->controller().updateBackend();
+ form_.updateBackend();
}
/* FIXME (Ugras 17/11/06):
QModelIndexList const & list = tocTV->selectionModel()->selectedIndexes();
if (!list.isEmpty()) {
enableControls(false);
- form_->goTo(typeCO->currentIndex(), list[0]);
- form_->controller().outlineUp();
+ form_.goTo(typeCO->currentIndex(), list[0]);
+ form_.outlineUp();
enableControls(true);
}
}
QModelIndexList const & list = tocTV->selectionModel()->selectedIndexes();
if (!list.isEmpty()) {
enableControls(false);
- form_->goTo(typeCO->currentIndex(), list[0]);
- form_->controller().outlineDown();
+ form_.goTo(typeCO->currentIndex(), list[0]);
+ form_.outlineDown();
enableControls(true);
}
}
QModelIndexList const & list = tocTV->selectionModel()->selectedIndexes();
if (!list.isEmpty()) {
enableControls(false);
- form_->goTo(typeCO->currentIndex(), list[0]);
- form_->controller().outlineIn();
+ form_.goTo(typeCO->currentIndex(), list[0]);
+ form_.outlineIn();
enableControls(true);
}
}
QModelIndexList const & list = tocTV->selectionModel()->selectedIndexes();
if (!list.isEmpty()) {
enableControls(false);
- form_->goTo(typeCO->currentIndex(), list[0]);
- form_->controller().outlineOut();
+ form_.goTo(typeCO->currentIndex(), list[0]);
+ form_.outlineOut();
enableControls(true);
}
}
{
updateTB->setEnabled(enable);
- if (!form_->canOutline(typeCO->currentIndex()))
+ if (!form_.canOutline(typeCO->currentIndex()))
enable = false;
moveUpTB->setEnabled(enable);
}
-void TocWidget::update()
+void TocWidget::updateView()
{
LYXERR(Debug::GUI) << "In TocWidget::updateView()" << endl;
- select(form_->getCurrentIndex(typeCO->currentIndex()));
- QWidget::update();
+ select(form_.getCurrentIndex(typeCO->currentIndex()));
}
void TocWidget::updateGui()
{
- vector<docstring> const & type_names = form_->controller().typeNames();
+ vector<docstring> const & type_names = form_.typeNames();
if (type_names.empty()) {
enableControls(false);
typeCO->clear();
if (current_type != -1)
typeCO->setCurrentIndex(current_type);
else
- typeCO->setCurrentIndex(form_->controller().selectedType());
+ typeCO->setCurrentIndex(form_.selectedType());
typeCO->blockSignals(false);
setTocModel(typeCO->currentIndex());
void TocWidget::setTocModel(size_t type)
{
bool controls_enabled = false;
- QStandardItemModel * toc_model = form_->tocModel(type);
+ QStandardItemModel * toc_model = form_.tocModel(type);
if (toc_model) {
controls_enabled = toc_model->rowCount() > 0;
tocTV->setModel(toc_model);
reconnectSelectionModel();
if (controls_enabled) {
- depthSL->setMaximum(form_->getTocDepth(type));
+ depthSL->setMaximum(form_.getTocDepth(type));
depthSL->setValue(depth_);
}
LYXERR(Debug::GUI) << "In TocWidget::updateGui()" << endl;
- select(form_->getCurrentIndex(typeCO->currentIndex()));
+ select(form_.getCurrentIndex(typeCO->currentIndex()));
if (toc_model) {
LYXERR(Debug::GUI)