3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
12 #include "FormIndex.h"
19 FormIndex::FormIndex(LyXView *v, Dialogs *d)
20 : dialog_(0), lv_(v), d_(d), inset_(0), h_(0), u_(0), ih_(0)
22 d->showIndex.connect(slot(this, &FormIndex::showIndex));
23 d->createIndex.connect(slot(this, &FormIndex::createIndex));
27 FormIndex::~FormIndex()
33 void FormIndex::showIndex(InsetCommand * const inset)
35 // FIXME: when could inset be 0 here ?
40 readonly = lv_->buffer()->isReadonly();
41 ih_ = inset_->hide.connect(slot(this,&FormIndex::hide));
42 params = inset->params();
48 void FormIndex::createIndex(string const & arg)
50 // we could already be showing an index entry, clear it out
54 readonly = lv_->buffer()->isReadonly();
55 params.setFromString(arg);
60 void FormIndex::update(bool switched)
67 dialog_->setIndexText(params.getContents().c_str());
68 dialog_->setReadOnly(readonly);
72 void FormIndex::apply()
77 params.setContents(dialog_->getIndexText());
80 if (params != inset_->params()) {
81 inset_->setParams(params);
82 lv_->view()->updateInset(inset_, true);
85 lv_->getLyXFunc()->Dispatch(LFUN_INDEX_INSERT, params.getAsString().c_str());
89 void FormIndex::show()
92 dialog_ = new IndexDialog(this, 0, _("LyX: Index"));
94 if (!dialog_->isVisible()) {
95 h_ = d_->hideBufferDependent.connect(slot(this, &FormIndex::hide));
96 u_ = d_->updateBufferDependent.connect(slot(this, &FormIndex::update));
100 dialog_->setActiveWindow();
107 void FormIndex::close()
116 void FormIndex::hide()