if (inset && theLockingInset() == inset) {
inset->insetUnlock(this);
theLockingInset(0);
+ // make sure we update the combo !
+ owner()->setLayout(getLyXText()->cursor.par()->getLayout());
finishUndo();
return 0;
} else if (inset && theLockingInset() &&
theLockingInset()->unlockInsetInInset(this, inset)) {
+ // owner inset has updated the layout combo
finishUndo();
return 0;
}
bool BufferView::ChangeInsets(Inset::Code code,
string const & from, string const & to)
{
- bool flag = false;
+ bool need_update = false;
LyXCursor cursor = text->cursor;
LyXCursor tmpcursor = cursor;
cursor.par(tmpcursor.par());
for (ParIterator it = buffer()->par_iterator_begin();
it != end; ++it) {
Paragraph * par = *it;
- bool flag2 = false;
+ bool changed_inset = false;
for (Paragraph::inset_iterator it2 = par->inset_iterator_begin();
it2 != par->inset_iterator_end(); ++it2) {
if ((*it2)->lyxCode() == code) {
InsetCommand * inset = static_cast<InsetCommand *>(*it2);
if (inset->getContents() == from) {
inset->setContents(to);
- flag2 = true;
+ changed_inset = true;
}
}
}
- if (flag2) {
- flag = true;
-#warning Fix me
+ if (changed_inset) {
+ need_update = true;
+#ifdef WITH_WARNINGS
+#warning FIXME
+#endif
// The test it.size()==1 was needed to prevent crashes.
// How to set the cursor corretly when it.size()>1 ??
if (it.size() == 1) {
}
}
text->setCursorIntern(this, cursor.par(), cursor.pos());
- return flag;
+ return need_update;
}
+2001-12-05 John Levon <moz@compsoc.man.ac.uk>
+
+ * LyXView.C:
+ * BufferView2.C: fix layout combo update on inset unlock
+
2001-12-05 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am: don't compile unused files
toolbar->updateLayoutList(false);
}
- layout_type layout = bufferview->text->cursor.par()->getLayout();
+ layout_type layout = bufferview->getLyXText()->cursor.par()->getLayout();
- if (layout != current_layout){
+ if (layout != current_layout) {
toolbar->setLayout(layout);
current_layout = layout;
}