apply combo.diff

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3163 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-12-05 23:16:13 +00:00
parent ff885b3ed3
commit 6b6d49b7df
3 changed files with 19 additions and 9 deletions

View File

@ -456,10 +456,13 @@ int BufferView::unlockInset(UpdatableInset * inset)
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;
}
@ -488,7 +491,7 @@ void BufferView::updateInset(Inset * inset, bool mark_dirty)
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());
@ -498,20 +501,22 @@ bool BufferView::ChangeInsets(Inset::Code code,
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) {
@ -523,7 +528,7 @@ bool BufferView::ChangeInsets(Inset::Code code,
}
}
text->setCursorIntern(this, cursor.par(), cursor.pos());
return flag;
return need_update;
}

View File

@ -1,3 +1,8 @@
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

View File

@ -206,9 +206,9 @@ void LyXView::updateLayoutChoice()
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;
}