RE: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-06 Thread Vincent van Ravesteijn - TNW
>the next step in that patch would be to remove passing of >the BufferView object to lyxfind.cpp (and corresponding >putSelectionAt() and replace functionality), but limit it >to exclusively returning the match (DocIterator and length, >a bool does not suffice), or making some progress towards >fin

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-06 Thread José Matos
On Wednesday 06 January 2010 13:03:26 Tommaso Cucinotta wrote: > yes of couse. I keep wonderiing why software components communicate > among each other by means of formatting/parsing human-readable strings ! > (similarly to kernel-space user-space comms that happens when you open > `top' or gnom

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-06 Thread Tommaso Cucinotta
Vincent van Ravesteijn - TNW wrote: AFAICS, what is returned by an LFUN may be LFUN dependent. So we have two options: 1) use the string-encoded return mechanism, similarly to the current LFUN argument passing (personally disliked); 2) use a basic DispatchResult class with proper subclasses which

RE: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-06 Thread Vincent van Ravesteijn - TNW
>> This particular version seems unnecessarily complex. >> FuncRequest should just have a DispatchResult member. >> The pointer member is asking for trouble, I think. > >AFAICS, what is returned by an LFUN may be LFUN dependent. >So we have two options: 1) use the string-encoded return >mechanism

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-06 Thread Tommaso Cucinotta
rgheck wrote: This particular version seems unnecessarily complex. FuncRequest should just have a DispatchResult member. The pointer member is asking for trouble, I think. AFAICS, what is returned by an LFUN may be LFUN dependent. So we have two options: 1) use the string-encoded return mechani

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-06 Thread Tommaso Cucinotta
Vincent van Ravesteijn - TNW wrote: I'd also want to figure out some way to allow just the DispatchResult member to be modified, even when FuncRequest is const. You mean you want to declare it "mutable" ? I thought to this option as well, but I think it would probably be even worse as

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Andre Poenitz
On Tue, Jan 05, 2010 at 06:10:03PM +0100, Jean-Marc Lasgouttes wrote: > "Vincent van Ravesteijn - TNW" writes: > > So, why are we discussing it then .. Because we need it ? > > > > Isn't the use of cur.dispatched(), cur.undispatched(), > > cur.result().dispatched() basically a work-around for miss

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread rgheck
On 01/05/2010 10:58 AM, Vincent van Ravesteijn - TNW wrote: I'd also want to figure out some way to allow just the DispatchResult member to be modified, even when FuncRequest is const. You mean you want to declare it "mutable" ? That is one possibility, though the way Tomasso ha

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Jean-Marc Lasgouttes
"Vincent van Ravesteijn - TNW" writes: > So, why are we discussing it then .. Because we need it ? > > Isn't the use of cur.dispatched(), cur.undispatched(), > cur.result().dispatched() basically a work-around for missing the > DispatchResult which only works in places where there is a Cursor > av

RE: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Vincent van Ravesteijn - TNW
>>> 3) let the LFUN dispatch in lyxfind.cpp return the required >>> information (match position and length) to the caller; for example, >>> by means of a DispatchResult sub-class (any strong objection to >>> adding a "DispatchResult &" to some of the existing ::dispatch() >>> methods? >>> >> I

RE: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Vincent van Ravesteijn - TNW
>I'd also want to figure out some way to allow just the >DispatchResult member to be modified, even when FuncRequest >is const. You mean you want to declare it "mutable" ? Vincent

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread rgheck
On 01/05/2010 09:12 AM, Tommaso Cucinotta wrote: Tommaso Cucinotta wrote: 3) let the LFUN dispatch in lyxfind.cpp return the required information (match position and length) to the caller; for example, by means of a DispatchResult sub-class (any strong objection to adding a "DispatchRes

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Jean-Marc Lasgouttes
rgheck writes: > On 01/04/2010 06:37 PM, Tommaso Cucinotta wrote: >> 3) let the LFUN dispatch in lyxfind.cpp return the required >> information (match position and length) to the caller; for example, >> by means of a DispatchResult sub-class (any strong objection to >> adding a "DispatchResult &"

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Tommaso Cucinotta
Tommaso Cucinotta wrote: 3) let the LFUN dispatch in lyxfind.cpp return the required information (match position and length) to the caller; for example, by means of a DispatchResult sub-class (any strong objection to adding a "DispatchResult &" to some of the existing ::dispatch() method

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Abdelrazak Younes
rgheck wrote: On 01/05/2010 08:54 AM, Abdelrazak Younes wrote: The multi-file search need not be, but could call that LFUN repeatedly. Or rather call the Buffer method. Because we don't want to create a BufferView for that search. Or we could also duplicate LFUN_FINDADV in Buffer in addtio

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread rgheck
On 01/05/2010 08:54 AM, Abdelrazak Younes wrote: The multi-file search need not be, but could call that LFUN repeatedly. Or rather call the Buffer method. Because we don't want to create a BufferView for that search. Or we could also duplicate LFUN_FINDADV in Buffer in addtion to BufferView

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Abdelrazak Younes
rgheck wrote: On 01/05/2010 08:44 AM, Abdelrazak Younes wrote: Tommaso Cucinotta wrote: Abdelrazak Younes wrote: You can use the paragraph id and the position in that paragraph. Else there is the StableDocIterator IIRC. I can see operator<<() but not operator>>(), both for StableDocIterator a

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread rgheck
On 01/05/2010 08:44 AM, Abdelrazak Younes wrote: Tommaso Cucinotta wrote: Abdelrazak Younes wrote: You can use the paragraph id and the position in that paragraph. Else there is the StableDocIterator IIRC. I can see operator<<() but not operator>>(), both for StableDocIterator and for CursorSl

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Abdelrazak Younes
Tommaso Cucinotta wrote: Abdelrazak Younes wrote: You can use the paragraph id and the position in that paragraph. Else there is the StableDocIterator IIRC. I can see operator<<() but not operator>>(), both for StableDocIterator and for CursorSlice. I guess the operator<<()s are there just for

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread rgheck
On 01/04/2010 06:37 PM, Tommaso Cucinotta wrote: 3) let the LFUN dispatch in lyxfind.cpp return the required information (match position and length) to the caller; for example, by means of a DispatchResult sub-class (any strong objection to adding a "DispatchResult &" to some of the existing ::

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Tommaso Cucinotta
Abdelrazak Younes wrote: You can use the paragraph id and the position in that paragraph. Else there is the StableDocIterator IIRC. I can see operator<<() but not operator>>(), both for StableDocIterator and for CursorSlice. I guess the operator<<()s are there just for debugging purposes, not r

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-05 Thread Abdelrazak Younes
Tommaso Cucinotta wrote: Vincent van Ravesteijn - TNW wrote: This is not only caused by the fact that you're using LFUN_BUFFER_SWITCH instead of GuiView::setBuffer, but also by the fact that you now call LFUN_FINDADV for each buffer, so it will be shown anyway when dispatching this LFUN. If you

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-04 Thread Tommaso Cucinotta
Vincent van Ravesteijn - TNW wrote: This is not only caused by the fact that you're using LFUN_BUFFER_SWITCH instead of GuiView::setBuffer, but also by the fact that you now call LFUN_FINDADV for each buffer, so it will be shown anyway when dispatching this LFUN. If you really want to search in

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-04 Thread rgheck
On 01/04/2010 09:00 AM, Vincent van Ravesteijn - TNW wrote: If you really want to search in hidden buffers (and/or non-current workareas) we either have to change some design, we can hide the buffer again when nothing is found, or freeze the view for a moment such that we can switch buffer witho

RE: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-04 Thread Vincent van Ravesteijn - TNW
>> However, I'm not sure whether everyone likes this approach. Anyway, I >> think the concept of the LFUN being dispatched or not is what you >> need: did I get a result or didn't anything happen. >just to mention that r32760 follows your advice (scopes and buffer >switch handled in F&R widget).

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-04 Thread Tommaso Cucinotta
Hello, Vincent van Ravesteijn wrote: Maybe it's already "wrong" to do this buffer management in lyxfind.cpp. [...] Well there is a way to do this. See the attached patch. However, I'm not sure whether everyone likes this approach. Anyway, I think the concept of the LFUN being dispatched or

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-03 Thread Abdelrazak Younes
On 02/01/2010 03:07, Vincent van Ravesteijn wrote: Tommaso Cucinotta schreef: However, in order to implement this, I would need to call the GuiWorkArea * GuiView::workArea(Buffer & buffer) on a related note, what is the "Buffer::gui_" field ? What is the purpose of those "gui delegate" ? If

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-02 Thread Andre Poenitz
On Fri, Jan 01, 2010 at 05:09:24PM +0100, Tommaso Cucinotta wrote: >>> GuiWorkArea * GuiView::workArea(Buffer & buffer) > on a related note, what is the "Buffer::gui_" field ? What is the > purpose of those "gui delegate" ? If I call "hasGuiDelegate()", is that > equivalent to checking that th

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-02 Thread Tommaso Cucinotta
Vincent van Ravesteijn wrote: We use the LFUNs to communicate from the GUI to the core. So, it's not necessary to communicate from a Widget (which has a view_ member) to the GuiView by means of an LFUN. 3) then I would call a GuiView::findAdv() method, which would implement the "scope" func

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-01 Thread Vincent van Ravesteijn
Tommaso Cucinotta schreef: Vincent van Ravesteijn wrote: So, if you think about this, you'd say that it's already "wrong" that you want to have this information about a buffer in lyxfind.cpp. Maybe it's already "wrong" to do this buffer management in lyxfind.cpp. I'm sure it is wrong, I'm only

About parent/child relationships (was: Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4)

2010-01-01 Thread Tommaso Cucinotta
rgheck wrote: On 12/31/2009 02:45 PM, Tommaso Cucinotta wrote: While traveling, I was thinking to a couple of unusual use-cases: 1) create a.lyx and b.lyx 2) let a.lyx include b.lyx 3) let b.lyx include a.lyx I just tried, and we have segfault after 3) (infinite recursion in Buffer::masterBuf

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-01 Thread Tommaso Cucinotta
Vincent van Ravesteijn wrote: I guess the rationale is that we open all children automatically too. So, if you're working on a multi-part document, you'd only have to open the master to have all children, but then it's convenient that if you close the master you'll also close all children. So

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-01 Thread rgheck
On 01/01/2010 11:09 AM, Tommaso Cucinotta wrote: on a related note, what is the "Buffer::gui_" field ? What is the purpose of those "gui delegate" ? If I call "hasGuiDelegate()", is that equivalent to checking that the buffer has an associated view (workarea and bufferview) ? No, I think hasG

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-01 Thread rgheck
On 01/01/2010 07:03 AM, Vincent van Ravesteijn wrote: it seems the master changes according to the last-loaded master. Also, when closing one of the two masters, its child is also closed. This is expected, basically, at least the first part. That the child closes whichever master closes is wro

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-01 Thread Tommaso Cucinotta
Vincent van Ravesteijn wrote: So, if you think about this, you'd say that it's already "wrong" that you want to have this information about a buffer in lyxfind.cpp. Maybe it's already "wrong" to do this buffer management in lyxfind.cpp. I'm sure it is wrong, I'm only trying to proceed increment

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-01 Thread Vincent van Ravesteijn
However, I'd like to raise your attention to another issue: when searching in S_OPEN_BUFFERS scope, currently I'm searching within both explicitly open (and displayed) and hidden buffers. Apparently, from a user perspective, it may seem more clear to search only within explicitly (and display

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-01 Thread Vincent van Ravesteijn
Tommaso Cucinotta schreef: rgheck wrote: I just tried, and we have segfault after 3) (infinite recursion in Buffer::masterBuffer() [1]). Probably such operation attempt should give up with an error to the user (but it may not be easy to identify an arbitrary "loop" in what is supposed to be a

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-01 Thread Tommaso Cucinotta
Vincent van Ravesteijn - TNW wrote: I prefer to use lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH, dest_buffer_->absFileName())); or isn't that possible ? I guess we try to keep the LyXView.h interface as small as possible. SelectDocumentBuffer does nothing else

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2010-01-01 Thread Tommaso Cucinotta
rgheck wrote: I just tried, and we have segfault after 3) (infinite recursion in Buffer::masterBuffer() [1]). Probably such operation attempt should give up with an error to the user (but it may not be easy to identify an arbitrary "loop" in what is supposed to be a DAG, with documents that ar

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2009-12-31 Thread rgheck
On 12/31/2009 02:45 PM, Tommaso Cucinotta wrote: While traveling, I was thinking to a couple of unusual use-cases: 1) create a.lyx and b.lyx 2) let a.lyx include b.lyx 3) let b.lyx include a.lyx I just tried, and we have segfault after 3) (infinite recursion in Buffer::masterBuffer() [1]). Pro

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2009-12-31 Thread Vincent van Ravesteijn
Tommaso Cucinotta schreef: While traveling, I was thinking to a couple of unusual use-cases: 1) create a.lyx and b.lyx 2) let a.lyx include b.lyx 3) let b.lyx include a.lyx I just tried, and we have segfault after 3) (infinite recursion in Buffer::masterBuffer() [1]). Probably such operation a

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2009-12-31 Thread Tommaso Cucinotta
While traveling, I was thinking to a couple of unusual use-cases: 1) create a.lyx and b.lyx 2) let a.lyx include b.lyx 3) let b.lyx include a.lyx I just tried, and we have segfault after 3) (infinite recursion in Buffer::masterBuffer() [1]). Probably such operation attempt should give up with

RE: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2009-12-31 Thread Vincent van Ravesteijn - TNW
>AFAIU, from Vincent's comments, perhaps such thing may be >obtained with something like: > > p_buffer->masterBuffer()->allRelatives() > No, it does not include grand-children. Is this a bug ? Doesn't p_buffer->masterBuffer()->getChildren() do what you want (except that the master is not inclu

RE: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2009-12-31 Thread Vincent van Ravesteijn - TNW
>On a related note, can anyone tell me whether or not the >"Buffer::allRelatives()" method is supposed to contain also >the buffer on which it is called ? And, also, whether it >includes "cousins" ? > Well, have a look at the Buffer::collectRelatives() function: >void Buffer::collectRelatives(Buf

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2009-12-31 Thread Tommaso Cucinotta
Tommaso Cucinotta wrote: in my mind, I was distinguishing between a "buffer", and a "document", composed of one or more buffers. On a related note, can anyone tell me whether or not the "Buffer::allRelatives()" method is supposed to contain also the buffer on which it is called ? And, also, wh

Re: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2009-12-31 Thread Tommaso Cucinotta
Vincent van Ravesteijn - TNW wrote: I prefer to use lyx::dispatch(FuncRequest(LFUN_BUFFER_SWITCH, dest_buffer_->absFileName())); or isn't that possible ? I'll try that and, if works, remove the new function. Maybe it's good to say that we're are stepping thro

RE: r32678 - in lyx-devel/trunk/src: . frontends frontends/qt4

2009-12-31 Thread Vincent van Ravesteijn - TNW
>Author: tommaso >Date: Wed Dec 30 19:40:18 2009 >New Revision: 32678 >URL: http://www.lyx.org/trac/changeset/32678 > >Log: >Implemented the "Current Buffer" & "Current (Master) Document" >scopes in the Advanced Find and Replace feature. > >Modified: lyx-devel/trunk/src/frontends/LyXView.h >==