Re: Proof of concept patch for bug 4812.

2008-07-09 Thread Jean-Marc Lasgouttes
rgheck <[EMAIL PROTECTED]> writes: > I think maybe you're extending the wrong thing, then. The extended > layouts should go into the DocumentClass object associated with the > Buffer, rather than into the LayoutFile object. I think that will > "just work". Very interesting indeed. Thanks. JMarc

Re: Proof of concept patch for bug 4812.

2008-07-09 Thread lasgouttes
"Bo Peng" <[EMAIL PROTECTED]> writes: >> This is why the paragraph should store the name of the layout, and the >> pointer should just be a cache (that gets populated on demand, maybe). >> There is of course a memory overhead, but this has to be evaluated. > > I do not know, these changes might be

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread rgheck
Jean-Marc Lasgouttes wrote: "Bo Peng" <[EMAIL PROTECTED]> writes: I do not really understand why you need to create several unknown layouts. Each textclass should have its own. Currently, I extend a standard textclass such as article when it is applied to another document. This exten

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread rgheck
Bo Peng wrote: I do not really understand why you need to create several unknown layouts. Each textclass should have its own. Currently, I extend a standard textclass such as article when it is applied to another document. This extended layout list is then available when a standard article

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread Bo Peng
> Can't you just rename the merged layouts into something like > 'OtherUnknown', 'OtherList' or whatever. When I write the document back, I would like to keep the layout names. Bo

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread Andre Poenitz
On Tue, Jul 08, 2008 at 10:59:12AM -0500, Bo Peng wrote: > > I do not really understand why you need to create several unknown > > layouts. Each textclass should have its own. > > Currently, I extend a standard textclass such as article when it is > applied to another document. This extended layou

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread Bo Peng
> This is why the paragraph should store the name of the layout, and the > pointer should just be a cache (that gets populated on demand, maybe). > There is of course a memory overhead, but this has to be evaluated. I do not know, these changes might be too big for 1.6.0. I will propose a patch as

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread Jean-Marc Lasgouttes
"Bo Peng" <[EMAIL PROTECTED]> writes: >> I do not really understand why you need to create several unknown >> layouts. Each textclass should have its own. > > Currently, I extend a standard textclass such as article when it is > applied to another document. This extended layout list is then > avai

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread Bo Peng
> I do not really understand why you need to create several unknown > layouts. Each textclass should have its own. Currently, I extend a standard textclass such as article when it is applied to another document. This extended layout list is then available when a standard article is created. The pr

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread Jean-Marc Lasgouttes
"Bo Peng" <[EMAIL PROTECTED]> writes: >> If you can get it to work properly, this is definitely the way to go. >> This shall be done for unknown classes and for unknown layouts. > > I have it almost working here, but there are some subtle problems such > as when two 'article' documents having some

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread Bo Peng
> > If you can get it to work properly, this is definitely the way to go. > This shall be done for unknown classes and for unknown layouts. I have it almost working here, but there are some subtle problems such as when two 'article' documents having some different 'unknown' layouts. Currently, the

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread Jean-Marc Lasgouttes
"Bo Peng" <[EMAIL PROTECTED]> writes: > Will anyone object the idea of totally removing hasLayout() and the > layout conversion process? Basically, any unknown textclass and > unknown layout will act like a standard layout but will keep their > names. Different textclasses can be applied to a docum

Re: Proof of concept patch for bug 4812.

2008-07-08 Thread Bo Peng
> Currently, when a LyX document without a proper (system or local) > layout file is opened, the default textclass (article) is used. This > changes the document and will result in data loss if the document is > saved. Will anyone object the idea of totally removing hasLayout() and the layout conv

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Bo Peng
> There is a risk for sure and a profiling session would be required if we > switch to name based access. But the bottlenecks of years back may have > disappeared now. I do not see anything wrong with a pointer based system as long as we use a container that will not invalidate these pointers. st

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Abdelrazak Younes
[EMAIL PROTECTED] wrote: rgheck <[EMAIL PROTECTED]> writes: Yes, I'm not at all sure how often we actually need to access a paragraph's layout. And I thought about converting LayoutList to a map a while ago, but didn't do it. And index-based access is also worth a thought, too. That would be

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread rgheck
[EMAIL PROTECTED] wrote: rgheck <[EMAIL PROTECTED]> writes: Yes, I'm not at all sure how often we actually need to access a paragraph's layout. And I thought about converting LayoutList to a map a while ago, but didn't do it. And index-based access is also worth a thought, too. That would be

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread lasgouttes
rgheck <[EMAIL PROTECTED]> writes: > Yes, I'm not at all sure how often we actually need to access a > paragraph's layout. And I thought about converting LayoutList to a > map a while ago, but didn't do it. And index-based access is > also worth a thought, too. That would be OK, as long as we only

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread rgheck
Abdelrazak Younes wrote: Bo Peng wrote: This makes the use of layout pointers seem kind of fragile. Maybe we should just store the name of the layout instead, and then use TextClass::operator[] to find the layout when we need it. There may be other benefits to doing it that way, too. If

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Bo Peng
>> The performance impact will be big because this layout pointer is used >> everywhere. Even storing layout index is better than storing their >> names. > > Using names would mean a map or a hash table (better) instead of a vector > (which could lead to index based access). Maybe the perfomance im

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Abdelrazak Younes
Bo Peng wrote: This makes the use of layout pointers seem kind of fragile. Maybe we should just store the name of the layout instead, and then use TextClass::operator[] to find the layout when we need it. There may be other benefits to doing it that way, too. If there's no performance pro

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Bo Peng
>> This makes the use of layout pointers seem kind of fragile. Maybe we >> should just store the name of the layout instead, and then use >> TextClass::operator[] to find the layout when we need it. There may be other >> benefits to doing it that way, too. > > If there's no performance problem, tha

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Jean-Marc Lasgouttes
"Bo Peng" <[EMAIL PROTECTED]> writes: > 1. A document without valid layout will be opened with a warning. (The same) > 2. All layouts are usable, although they all look like "standard" (changed) > 3. Save such a document will not lose data. The original layout name > will be used. (improved) > 4.

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Abdelrazak Younes
rgheck wrote: Bo Peng wrote: The biggest problem with this patch is that because layout pointers are used directly, LayoutList, which is std:;vector can not be expanded dynamically. I change it to std::list to allow dynamic growth of the "unknown" textclass but this may lead to performance pro

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread rgheck
Bo Peng wrote: The biggest problem with this patch is that because layout pointers are used directly, LayoutList, which is std:;vector can not be expanded dynamically. I change it to std::list to allow dynamic growth of the "unknown" textclass but this may lead to performance problems.

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Bo Peng
> This looks like a sensible approach in general. Is the document class then > not reset? So if I have ClassX, and this is not found, will LyX keep this > ClassX unless I manually switch to another class? (This is the way it > should be IMHO). Yes. All layouts are kept, although the textclass is n

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Bo Peng
>> 4. Another layout can be chosen from Document -> settings, if a >> correct textclass is selected, all layouts will work fine. (improved, >> because the current approach will change some unknown layouts to >> standard.) >> > > I think this is not enough. If the local layout is to be supported, th

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Juergen Spitzmueller
Bo Peng wrote: > 1. A document without valid layout will be opened with a warning. (The > same) 2. All layouts are usable, although they all look like "standard" > (changed) 3. Save such a document will not lose data. The original layout > name will be used. (improved) > 4. Another layout can be c

Re: Proof of concept patch for bug 4812.

2008-07-07 Thread Abdelrazak Younes
Bo Peng wrote: Dear all, 3. Use this expandable "unknown" layout for a document without valid layout. } else { // a warning will be given for unknown class - setBaseClass(defaultBaseclass()); + setBaseClass(unk

Proof of concept patch for bug 4812.

2008-07-06 Thread Bo Peng
Dear all, Currently, when a LyX document without a proper (system or local) layout file is opened, the default textclass (article) is used. This changes the document and will result in data loss if the document is saved. The attached patch: 1. Adds a default Text "unknown" layout in the construc