From: Vincent van Ravesteijn Date: Thu, 17 Jun 2010 21:18:08 +0000 (+0000) Subject: Better fix for bug #5942: proper multi-window usage is restored again. Now, LyX only... X-Git-Tag: 2.0.0~3110 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=f27ccb580b7a30b3d4a1b45198f454696c4ef90d;p=features.git Better fix for bug #5942: proper multi-window usage is restored again. Now, LyX only switches to a buffer in a different view if open in tabs is disabled and there is already a document open in the current view and the buffer is already opened in another view. see r34618. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34684 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 37d7cf4437..e4e4d39b78 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -2950,19 +2950,28 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr) break; } case LFUN_BUFFER_SWITCH: { - if (!FileName::isAbsolute(to_utf8(cmd.argument()))) + string const file_name = to_utf8(cmd.argument()); + if (!FileName::isAbsolute(file_name)) { + dr.setError(true); + dr.setMessage(_("Absolute filename expected.")); break; - Buffer * buffer = - theBufferList().getBuffer(FileName(to_utf8(cmd.argument()))); + } + + Buffer * buffer = theBufferList().getBuffer(FileName(file_name)); if (!buffer) { dr.setError(true); dr.setMessage(_("Document not loaded")); break; - } - if (workArea(*buffer)) { + } + + // Do we open or switch to the buffer in this view ? + if (workArea(*buffer) + || lyxrc.open_buffers_in_tabs || !documentBufferView()) { setBuffer(buffer); break; - } + } + + // Look for the buffer in other views QList const ids = guiApp->viewIds(); int i = 0; for (; i != ids.size(); ++i) { @@ -2973,13 +2982,11 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr) break; } } + + // If necessary, open a new window as a last resort if (i == ids.size()) { - if (!lyxrc.open_buffers_in_tabs && documentBufferView() != 0) { - lyx::dispatch(FuncRequest(LFUN_WINDOW_NEW)); - lyx::dispatch(cmd); - } else { - setBuffer(buffer); - } + lyx::dispatch(FuncRequest(LFUN_WINDOW_NEW)); + lyx::dispatch(cmd); } break; }