On 08/10/2010 05:16 PM, Jean-Marc Lasgouttes wrote:
While trying to fix #6786 (http://www.lyx.org/trac/ticket/6786), I found out
that the naming of Flex insets is very weird.

I think I looked at this once before and also found it weird.

So I know I am coming after the battle here, but I wonder what is the need of adding (or not) the Custom: prefix to the inset name. The inset name is going to be shown in the interface, and having this prefix in menus is rather ugly IMO.

If I remember correctly, I think there was a time when the Custom and CharStyle prefixes were used to decide where things went on the menu. But it isn't used for that now.

But in fact, we can chose _not_ to have it, and everything will work in the same way. The orthodox way of doing it would have been to have something like

InsetLayout Flex:Noun
  LyxType charstyle
 ...

Then this gets written in the lyx file as

\begin_inset Flex Noun
 ...

Question: Why even bother with the "Flex:" prefix? We don't have a default "InsetLayout Flex" and I don't see any reason to have one. Also....

I think that we should before 2.0 (but my time for doing it is going to be
scarce unfortunately) change our layouts and our LyX format to enforce
these rules. This will IMO make the menus look better and make sure that
everything is coherent. In the future, it will help us to have a single notion
of name and type for insets, which can be used for InsetLayout, but also
for naming inset dialogs and for the LyX file format. This will be helpful
IMO if we ever switch to xml.

The plan would be:

* layout2layout: for all insets layouts which name is not in the hardcoded list (Note, Branch...), including Custom:, CharStyle:, and Element:, remove the existing prefix
  and replace it with Flex:
* lyx2lyx: do the same, but do not add Flex: :)

If we do different things in these two places, then we have to change something in the C++ code, too. In particular, we'll have to add the "Flex" back onto the layout name when we create the InsetFlex. Otherwise, we get an InsetFlex whose name is "Noun", and it can't its layout, "Flex:Noun". There are various options, but this seems dangerous. If someone did want to create some "X:Y" insets, then how to handle those? Etc. So I'd just forget about "Flex:", and I don't think this would actually take much work. I.e., I could do it.

rh

Reply via email to