Hi all,

the attached patch adds the LFUN_MASTER_PREVIEW
command ("master-preview"), triggered through the
C-M-t binding (with the "ps" argument). When run from
a child document, this command shows a preview built
from the master buffer. If a master is not found, it
previews the current buffer.

I find it useful. Maybe others too.

   T.

Index: src/LyXAction.cpp
===================================================================
--- src/LyXAction.cpp	(revisione 20259)
+++ src/LyXAction.cpp	(copia locale)
@@ -128,6 +128,7 @@
 		{ LFUN_BUFFER_TOGGLE_READ_ONLY, "buffer-toggle-read-only", ReadOnly },
 		{ LFUN_BUFFER_UPDATE, "buffer-update", ReadOnly },
 		{ LFUN_BUFFER_VIEW, "buffer-view", ReadOnly },
+		{ LFUN_MASTER_VIEW, "master-view", ReadOnly },
 		{ LFUN_BUFFER_WRITE, "buffer-write", ReadOnly },
 		{ LFUN_BUFFER_WRITE_AS, "buffer-write-as", ReadOnly },
 		{ LFUN_BUFFER_WRITE_ALL, "buffer-write-all", ReadOnly },
Index: src/LyXFunc.cpp
===================================================================
--- src/LyXFunc.cpp	(revisione 20259)
+++ src/LyXFunc.cpp	(copia locale)
@@ -695,6 +695,7 @@
 	case LFUN_BUFFER_WRITE_AS:
 	case LFUN_BUFFER_UPDATE:
 	case LFUN_BUFFER_VIEW:
+	case LFUN_MASTER_VIEW:
 	case LFUN_BUFFER_IMPORT:
 	case LFUN_BUFFER_AUTO_SAVE:
 	case LFUN_RECONFIGURE:
@@ -999,6 +1000,14 @@
 			Exporter::preview(lyx_view_->buffer(), argument);
 			break;
 
+		case LFUN_MASTER_VIEW:
+			BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
+			if (lyx_view_->buffer()->getMasterBuffer())
+				Exporter::preview(lyx_view_->buffer()->getMasterBuffer(), argument);
+			else
+				Exporter::preview(lyx_view_->buffer(), argument);
+			break;
+
 		case LFUN_BUILD_PROGRAM:
 			BOOST_ASSERT(lyx_view_ && lyx_view_->buffer());
 			Exporter::Export(lyx_view_->buffer(), "program", true);
Index: src/lfuns.h
===================================================================
--- src/lfuns.h	(revisione 20259)
+++ src/lfuns.h	(copia locale)
@@ -403,6 +403,7 @@
 	LFUN_LAYOUT_MODULES_CLEAR,       // rgh, 20070825
 	LFUN_LAYOUT_MODULE_ADD,          // rgh, 20070825
 	LFUN_LAYOUT_RELOAD,              // rgh, 20070903
+	LFUN_MASTER_VIEW,		 // Tommaso
 
 	LFUN_LASTACTION                  // end of the table
 };
Index: lib/bind/cua.bind
===================================================================
--- lib/bind/cua.bind	(revisione 20259)
+++ lib/bind/cua.bind	(copia locale)
@@ -43,6 +43,7 @@
 \bind "C-p"			"dialog-show print"
 \bind "C-d"			"buffer-view dvi"	# 'd' for dvi
 \bind "C-t"			"buffer-view ps"
+\bind "C-M-t"			"master-view ps"
 \bind "C-S-D"			"buffer-update dvi"	# 'd' for dvi
 \bind "C-S-T"			"buffer-update ps"
 \bind "C-q"			"lyx-quit"

Reply via email to