Le 29/08/2016 à 17:02, Jean-Marc Lasgouttes a écrit :

This has been discussed some time ago. The command:
  command-alternative master-buffer-view; buffer-view
does what you want.

However, it would make sense to have a first-class command that just
does the right thing IMO.



The attached patch does what you want.

The only problem is that now "View/Update Master Document" is always
shown.

>From 683f25efbcb36cf0ff310395fe7cca1e7eaaf4a4 Mon Sep 17 00:00:00 2001
From: Guillaume Munch <g...@lyx.org>
Date: Thu, 22 Sep 2016 00:38:40 +0200
Subject: [PATCH] master-buffer-{view,update} now also work for non-child
 documents

---
 src/frontends/qt4/GuiView.cpp | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index 10ec74e..f401ace 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -1848,22 +1848,22 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
 
 	case LFUN_MASTER_BUFFER_UPDATE:
 	case LFUN_MASTER_BUFFER_VIEW:
-		enable = doc_buffer
-			&& (doc_buffer->parent() != 0
-			    || doc_buffer->hasChildren())
-			&& !d.processing_thread_watcher_.isRunning();
-		break;
-
 	case LFUN_BUFFER_UPDATE:
 	case LFUN_BUFFER_VIEW: {
 		if (!doc_buffer || d.processing_thread_watcher_.isRunning()) {
 			enable = false;
 			break;
 		}
+		// current or master buffer
+		Buffer const * buf =
+			(cmd.action() == LFUN_MASTER_BUFFER_UPDATE ||
+			 cmd.action() == LFUN_MASTER_BUFFER_VIEW)
+			? doc_buffer->masterBuffer()
+			: doc_buffer;
 		string format = to_utf8(cmd.argument());
 		if (cmd.argument().empty())
-			format = doc_buffer->params().getDefaultOutputFormat();
-		enable = doc_buffer->params().isExportableFormat(format);
+			format = buf->params().getDefaultOutputFormat();
+		enable = buf->params().isExportableFormat(format);
 		break;
 	}
 
-- 
2.7.4

Reply via email to