Backport the fixes for bug 5872.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@28923 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2009-03-26 17:39:11 +00:00
parent f038b33956
commit f106307c47
2 changed files with 30 additions and 2 deletions

View File

@ -1851,6 +1851,28 @@ bool GuiView::closeBuffer(Buffer & buf, bool tolastopened)
}
void GuiView::gotoNextOrPreviousBuffer(NextOrPrevious np)
{
Buffer * const curbuf = buffer();
Buffer * nextbuf = curbuf;
while (true) {
if (np == NEXTBUFFER)
nextbuf = theBufferList().next(nextbuf);
else
nextbuf = theBufferList().previous(nextbuf);
if (nextbuf == curbuf)
break;
if (nextbuf == 0) {
nextbuf = curbuf;
break;
}
if (workArea(*nextbuf))
break;
}
setBuffer(nextbuf);
}
bool GuiView::dispatch(FuncRequest const & cmd)
{
BufferView * bv = view();
@ -1869,11 +1891,11 @@ bool GuiView::dispatch(FuncRequest const & cmd)
break;
case LFUN_BUFFER_NEXT:
setBuffer(theBufferList().next(buffer()));
gotoNextOrPreviousBuffer(NEXTBUFFER);
break;
case LFUN_BUFFER_PREVIOUS:
setBuffer(theBufferList().previous(buffer()));
gotoNextOrPreviousBuffer(PREVBUFFER);
break;
case LFUN_COMMAND_EXECUTE: {

View File

@ -288,6 +288,12 @@ private:
bool saveBuffer(Buffer & b);
///
bool closeBuffer(Buffer & buf, bool tolastopened = false);
enum NextOrPrevious {
NEXTBUFFER,
PREVBUFFER
};
///
void gotoNextOrPreviousBuffer(NextOrPrevious np);
///
Inset * getOpenInset(std::string const & name) const;