Re: Layout Changes Inside CharStyles?

2016-06-21 Thread Richard Heck
On 06/21/2016 10:45 AM, José Abílio Matos wrote:
> On Tuesday, June 21, 2016 4:07:25 PM WEST Helge Hafting wrote:
>> I might use a charstyle to set large amounts (several paragraphs or an 
>> entire chapter) in a different color. I may still want headings & 
>> enumerations inside of that!
>>
>> It can perhaps be argued that I ought to use a paragraph style for this, and 
>> nest the other stuff inside. Currently, that is more cumbersome – especially 
>> the creation of a custom paragraph style.
> Then the solution here is to ease the creation of custom paragraph styles and 
> not to mix two different concepts.

You can also do a custom inset, which is the same as a character style,
except that it appears in a different place on the menu.

Note also that this proposal does not *prohibit* anything. It just makes
"ForcePlain 1" the default for charstyles.

Richard



Re: Layout Changes Inside CharStyles?

2016-06-21 Thread José Abílio Matos
On Tuesday, June 21, 2016 4:07:25 PM WEST Helge Hafting wrote:
> Why do we generally not want to change paragraph style just because some 
> char style is in effect?

The purpose of the char styles is to be used for inline elements, that is 
elements that are placed inside a paragraph.

Currently every char style is reset after the paragraph end, and if necessary 
set at the begin of the new. Why should the custom char styles behave in a 
different way, or if they do it call it a different name.
 
> I might use a charstyle to set large amounts (several paragraphs or an 
> entire chapter) in a different color. I may still want headings & 
> enumerations inside of that!
> 
> It can perhaps be argued that I ought to use a paragraph style for this, 
> and nest the other stuff inside. Currently, that is more cumbersome – 
> especially the creation of a custom paragraph style.

Then the solution here is to ease the creation of custom paragraph styles and 
not to mix two different concepts.

> Please be very careful about introducing functional limitations. The 
> people who apply a layout change by mistake, can use the excellent 
> "undo" facility.
> 
> Helge Hafting

-- 
José Abílio


Re: Layout Changes Inside CharStyles?

2016-06-21 Thread Helge Hafting



Den 20. juni 2016 17:34, skrev Richard Heck:

At the moment, it is possible to effect a layout change inside almost
all of our character styles. So far as I can see, this is almost always
a bug. One does not want, e.g., to be able to switch to an enumeration
inside the Code character style. So I propose the following simple patch:

Why do we generally not want to change paragraph style just because some 
char style is in effect?


I might use a charstyle to set large amounts (several paragraphs or an 
entire chapter) in a different color. I may still want headings & 
enumerations inside of that!


It can perhaps be argued that I ought to use a paragraph style for this, 
and nest the other stuff inside. Currently, that is more cumbersome – 
especially the creation of a custom paragraph style.


Please be very careful about introducing functional limitations. The 
people who apply a layout change by mistake, can use the excellent 
"undo" facility.


Helge Hafting


Re: Layout Changes Inside CharStyles?

2016-06-20 Thread Jean-Marc Lasgouttes

Le 21/06/2016 01:07, Richard Heck a écrit :

I would agree with this change, which should be properly documented.


PS Do you think this is all right for stable, even though it is a change of
behavior? We won't do anything with layout2layout


I tend to think so, but you should rather ask Georg or Juergen.

JMarc



Re: Layout Changes Inside CharStyles?

2016-06-20 Thread Richard Heck

On 06/20/2016 11:03 PM, Jean-Marc Lasgouttes wrote:

Le 20/06/2016 17:34, Richard Heck a écrit :


At the moment, it is possible to effect a layout change inside almost
all of our character styles. So far as I can see, this is almost always
a bug. One does not want, e.g., to be able to switch to an enumeration
inside the Code character style. So I propose the following simple 
patch:


I would agree with this change, which should be properly documented.


PS Do you think this is all right for stable, even though it is a change of
behavior? We won't do anything with layout2layout

Richard



Re: Layout Changes Inside CharStyles?

2016-06-20 Thread Richard Heck

On 06/20/2016 11:03 PM, Jean-Marc Lasgouttes wrote:

Le 20/06/2016 17:34, Richard Heck a écrit :


At the moment, it is possible to effect a layout change inside almost
all of our character styles. So far as I can see, this is almost always
a bug. One does not want, e.g., to be able to switch to an enumeration
inside the Code character style. So I propose the following simple 
patch:


I would agree with this change, which should be properly documented.

I also think that in this case the layout change should be done in the 
outer paragraph. After all, this is what happens in a math inset.


Yes, that could be done---and racoon suggested the same thing---but then 
I worry it will be misleading. You could change a layout and have it 
only affect a paragraph any number of embeddings up. It's also hard to 
see how this works with the combo box. Surley (?) we want that still to 
display "Plain Layout" in an inset with ForcePlain on. But then you 
could use it to change to some other layout, and yet it still shows 
"Plain Layout". Or do you propose it displays the layout of the 
containing paragraph that has a layout? This again seems potentially 
confusing.


Richafd



Re: Layout Changes Inside CharStyles?

2016-06-20 Thread Jean-Marc Lasgouttes

Le 20/06/2016 17:34, Richard Heck a écrit :


At the moment, it is possible to effect a layout change inside almost
all of our character styles. So far as I can see, this is almost always
a bug. One does not want, e.g., to be able to switch to an enumeration
inside the Code character style. So I propose the following simple patch:


I would agree with this change, which should be properly documented.

I also think that in this case the layout change should be done in the 
outer paragraph. After all, this is what happens in a math inset.


JMarc


Re: Layout Changes Inside CharStyles?

2016-06-20 Thread Richard Heck
On 06/20/2016 11:34 AM, Richard Heck wrote:
> At the moment, it is possible to effect a layout change inside almost
> all of our character styles. So far as I can see, this is almost always
> a bug. One does not want, e.g., to be able to switch to an enumeration
> inside the Code character style. So I propose the following simple patch:
>
> diff --git a/src/insets/InsetLayout.cpp b/src/insets/InsetLayout.cpp
> index a1677de..b41b630 100644
> --- a/src/insets/InsetLayout.cpp
> +++ b/src/insets/InsetLayout.cpp
> @@ -226,8 +226,10 @@ bool InsetLayout::read(Lexer & lex, TextClass const
> & tclass)
> lyxtype_ = translateLyXType(lt);
> if (lyxtype_  == NOLYXTYPE)
> LYXERR0("Unknown LyXType `" << lt << "'.");
> -   if (lyxtype_ == CHARSTYLE)
> +   if (lyxtype_ == CHARSTYLE) {
> multipar_ = false;
> +   forceplain_ = true;
> +   }
> break;
> }
> case IL_LATEXTYPE:  {
>
> which makes charstyles, by default, force the plain layout. If one
> really did want to be able to switch layouts, then one could later put
> "ForcePlain 0". So this does not prevent someone from doing that.
>
> Maybe this should be master-only, just in case someone used this 'feature'.

See http://www.lyx.org/trac/ticket/10237 for a case where this actually
causes a problem. It's because we had a Description inside an Alert
charstyle.

Richard