Re: Enable View master document even if there are no child documents

2016-09-23 Thread Guenter Milde
On 2016-09-23, Jean-Marc Lasgouttes wrote:
> Le 22/09/2016 à 00:43, Guillaume Munch a écrit :
>> The attached patch does what you want.

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

> What about renaming master-buffer-view to buffer-view and buffer-view to 
> child-buffer-view ("View only child", or something).

> As I understand it, racoon's idea is that viewing master is the norm and 
> viewing the child the exception. Currently, we do the opposite.

There are use-cases for both:

* A book with chapters in separate files with heavy cross-linking.

  - with include/includeonly  -> view := view-child
  - with input-> view := view-master

* Stand-alone documents that also have a "wapper" document

  -> view := view-child
  
* Beamer presentations with master == beamer article  

  -> view := view-child


I don't think there is a strong case for change (never touch a running
system). OTOH, users with a strong preference for 
   view := view-master or view-standalon
should be able to customize LyX.

However, the most important is to keep View and Export preferences in
sync. It would be a bad surprise to View the master as default but export
would only work from the master buffer!


Günter



Re: Enable View master document even if there are no child documents

2016-09-23 Thread Guillaume Munch

Le 23/09/2016 à 11:31, Jean-Marc Lasgouttes a écrit :

Le 22/09/2016 à 00:43, Guillaume Munch a écrit :

The attached patch does what you want.

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


What about renaming master-buffer-view to buffer-view and buffer-view to
child-buffer-view ("View only child", or something).

As I understand it, racoon's idea is that viewing master is the norm and
viewing the child the exception. Currently, we do the opposite.



I would support such a patch.




Re: Enable View master document even if there are no child documents

2016-09-23 Thread Jean-Marc Lasgouttes

Le 22/09/2016 à 00:43, Guillaume Munch a écrit :

The attached patch does what you want.

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


What about renaming master-buffer-view to buffer-view and buffer-view to 
child-buffer-view ("View only child", or something).


As I understand it, racoon's idea is that viewing master is the norm and 
viewing the child the exception. Currently, we do the opposite.


JMarc



Re: Enable View master document even if there are no child documents

2016-09-22 Thread Guillaume Munch

Le 22/09/2016 à 04:41, Richard Heck a écrit :

On 09/21/2016 06:43 PM, Guillaume Munch wrote:

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.


I suppose the thing to do is something like this: If we are the master,
then
disable LFUN_MASTER_BUFFER_VIEW and break; otherwise fall through.



I am not I understand our suggestion. Would that not disable 
master-buffer-view in even more cases than before, while we want to 
enable it even for standalone document?





Re: Enable View master document even if there are no child documents

2016-09-21 Thread Richard Heck
On 09/21/2016 06:43 PM, Guillaume Munch wrote:
> 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.

I suppose the thing to do is something like this: If we are the master,
then
disable LFUN_MASTER_BUFFER_VIEW and break; otherwise fall through.

Richard



Re: Enable View master document even if there are no child documents

2016-09-21 Thread Guillaume Munch

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 
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



Re: Enable View master document even if there are no child documents

2016-08-31 Thread racoon

On 29.08.2016 17:57, Guillaume Munch wrote:

The command:
  command-alternative[s] master-buffer-view; buffer-view
does what you want.


Is there a reason why the work area is focus on the current cursor 
position with this command? This is not the case with the other view 
commands.


Daniel



Re: Enable View master document even if there are no child documents

2016-08-29 Thread Guillaume Munch

Le 29/08/2016 à 16:05, Richard Heck a écrit :


Or just modify the bindings to use what's above.



+1




Re: Enable View master document even if there are no child documents

2016-08-29 Thread Michael Berger



On 08/29/2016 04:48 PM, racoon wrote:

On 29.08.2016 15:28, Michael Berger wrote:

Are you sure to have understood the concept of master-child?

Michael


On 08/29/2016 12:22 PM, racoon wrote:

Hi,

I almost never View child documents. Most of the time they don't
compile properly on their own anyway. So I would like to remove the
View button from my interface. Unfortunately, the View master document
button is grayed out if there are no child documents in a "master". Is
that on purpose? Why not enable it anyway? So one normally presses one
and the same button and only for the extraordinary circumstance of
viewing a child document has to press another button.


Maybe, you had in mind what is written in the User Guide:

"[The View Master Document] menu item is only visible if your document 
is included to another document, which is then its “master” (see 
section Child Documents in the Embedded Objects manual for more 
information on this topic)." (A.6.8)


This seems just plain wrong. The menu item (and the toolbar button) is 
visible in any master document as well.


Daniel


No Daniel,
the 'Select default master document' is open as you might want to use it 
as a child in another document, the then master. So you should not be to 
much concerned about this.


When you use/create/include a child document using > Insert > File > 
Child Document you will be presented the Child Documents option in the 
Documents Setting dialogue. And to me this is correct behavior.


If you do use child documents then the settings and preamble are stored 
in the master will rule (although there are some exceptions, e.g. 
modules that need to be set in a child's preamble).


That too is proper behavior in my opinion because otherwise you would 
have to write preambles and settings for each single child document. And 
you would not use the master-child concept for small documents - would you?


Now, as a consequence you most probably get an error when trying to 
compile a child document because it needs the settings of the master. 
You have to save the child first and then compile the master.


That is why I think your statement 'Most of the time they don't compile 
properly on their own anyway' is inappropriate.


Hope that I did not misunderstand you but this is what I have here.

Cheers,

Michael



Re: Enable View master document even if there are no child documents

2016-08-29 Thread Richard Heck
On 08/29/2016 11:10 AM, racoon wrote:
> On 29.08.2016 17:57, Guillaume Munch wrote:
>> Le 29/08/2016 à 11:22, racoon a écrit :
>>> Hi,
>>>
>>> I almost never View child documents. Most of the time they don't
>>> compile
>>> properly on their own anyway. So I would like to remove the View button
>>> from my interface. Unfortunately, the View master document button is
>>> grayed out if there are no child documents in a "master". Is that on
>>> purpose? Why not enable it anyway? So one normally presses one and the
>>> same button and only for the extraordinary circumstance of viewing a
>>> child document has to press another button.
>>>
>>
>> Hi,
>>
>> This has been discussed some time ago. The command:
>>   command-alternative master-buffer-view; buffer-view
>> does what you want.
>
> Thanks. But for some reason I get an "Unknown action" when using the
> command "command-alternative master-buffer-view; buffer-view". I guess
> I misunderstood something.

command-alternativeS

rh



Re: Enable View master document even if there are no child documents

2016-08-29 Thread racoon

On 29.08.2016 18:39, Richard Heck wrote:

On 08/29/2016 11:10 AM, racoon wrote:

On 29.08.2016 17:57, Guillaume Munch wrote:

Le 29/08/2016 à 11:22, racoon a écrit :

Hi,

I almost never View child documents. Most of the time they don't
compile
properly on their own anyway. So I would like to remove the View button
from my interface. Unfortunately, the View master document button is
grayed out if there are no child documents in a "master". Is that on
purpose? Why not enable it anyway? So one normally presses one and the
same button and only for the extraordinary circumstance of viewing a
child document has to press another button.



Hi,

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


Thanks. But for some reason I get an "Unknown action" when using the
command "command-alternative master-buffer-view; buffer-view". I guess
I misunderstood something.


command-alternativeS


Thanks! Used

Item "View master document" "command-alternatives master-buffer-view; 
buffer-view"
Item "Update master document" "command-alternatives 
master-buffer-update; buffer-update"


for my toolbar.

Daniel



Re: Enable View master document even if there are no child documents

2016-08-29 Thread racoon

On 29.08.2016 17:57, Guillaume Munch wrote:

Le 29/08/2016 à 11:22, racoon a écrit :

Hi,

I almost never View child documents. Most of the time they don't compile
properly on their own anyway. So I would like to remove the View button
from my interface. Unfortunately, the View master document button is
grayed out if there are no child documents in a "master". Is that on
purpose? Why not enable it anyway? So one normally presses one and the
same button and only for the extraordinary circumstance of viewing a
child document has to press another button.



Hi,

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


Thanks. But for some reason I get an "Unknown action" when using the 
command "command-alternative master-buffer-view; buffer-view". I guess I 
misunderstood something.





Re: Enable View master document even if there are no child documents

2016-08-29 Thread Richard Heck
On 08/29/2016 11:02 AM, Jean-Marc Lasgouttes wrote:
> Le 29/08/2016 à 16:57, Guillaume Munch a écrit :
>> Le 29/08/2016 à 11:22, racoon a écrit :
>>> Hi,
>>>
>>> I almost never View child documents. Most of the time they don't
>>> compile
>>> properly on their own anyway. So I would like to remove the View button
>>> from my interface. Unfortunately, the View master document button is
>>> grayed out if there are no child documents in a "master". Is that on
>>> purpose? Why not enable it anyway? So one normally presses one and the
>>> same button and only for the extraordinary circumstance of viewing a
>>> child document has to press another button.
>>>
>>
>> Hi,
>>
>> 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.

Or just modify the bindings to use what's above.

Richard



Re: Enable View master document even if there are no child documents

2016-08-29 Thread Jean-Marc Lasgouttes

Le 29/08/2016 à 16:57, Guillaume Munch a écrit :

Le 29/08/2016 à 11:22, racoon a écrit :

Hi,

I almost never View child documents. Most of the time they don't compile
properly on their own anyway. So I would like to remove the View button
from my interface. Unfortunately, the View master document button is
grayed out if there are no child documents in a "master". Is that on
purpose? Why not enable it anyway? So one normally presses one and the
same button and only for the extraordinary circumstance of viewing a
child document has to press another button.



Hi,

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.


JMarc



Re: Enable View master document even if there are no child documents

2016-08-29 Thread Guillaume Munch

Le 29/08/2016 à 11:22, racoon a écrit :

Hi,

I almost never View child documents. Most of the time they don't compile
properly on their own anyway. So I would like to remove the View button
from my interface. Unfortunately, the View master document button is
grayed out if there are no child documents in a "master". Is that on
purpose? Why not enable it anyway? So one normally presses one and the
same button and only for the extraordinary circumstance of viewing a
child document has to press another button.



Hi,

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





Re: Enable View master document even if there are no child documents

2016-08-29 Thread racoon

On 29.08.2016 15:28, Michael Berger wrote:

Are you sure to have understood the concept of master-child?

Michael


On 08/29/2016 12:22 PM, racoon wrote:

Hi,

I almost never View child documents. Most of the time they don't
compile properly on their own anyway. So I would like to remove the
View button from my interface. Unfortunately, the View master document
button is grayed out if there are no child documents in a "master". Is
that on purpose? Why not enable it anyway? So one normally presses one
and the same button and only for the extraordinary circumstance of
viewing a child document has to press another button.


Maybe, you had in mind what is written in the User Guide:

"[The View Master Document] menu item is only visible if your document 
is included to another document, which is then its “master” (see section 
Child Documents in the Embedded Objects manual for more information on 
this topic)." (A.6.8)


This seems just plain wrong. The menu item (and the toolbar button) is 
visible in any master document as well.


Daniel



Re: Enable View master document even if there are no child documents

2016-08-29 Thread racoon

On 29.08.2016 14:28, Michael Berger wrote:

Are you sure to have understood the concept of master-child?


I thought so. But maybe I haven't. But what makes you think I haven't?

Daniel



Re: Enable View master document even if there are no child documents

2016-08-29 Thread Michael Berger

Are you sure to have understood the concept of master-child?

Michael


On 08/29/2016 12:22 PM, racoon wrote:

Hi,

I almost never View child documents. Most of the time they don't 
compile properly on their own anyway. So I would like to remove the 
View button from my interface. Unfortunately, the View master document 
button is grayed out if there are no child documents in a "master". Is 
that on purpose? Why not enable it anyway? So one normally presses one 
and the same button and only for the extraordinary circumstance of 
viewing a child document has to press another button.


Daniel