Vincent van Ravesteijn ha scritto:
Tommaso Cucinotta schreef:
Is there any clean way to return something from the LFUN dispatch mechanism ?

No.
Explaining: I'd like to have a LFUN with a sort of return value, so that I can dispatch an LFUN from the GUI, then check some return value.
Please explain then.
Sure: I describe the current search behaviour (also standard search):
1. GUI dispatched LFUN
2. lyxfind.cpp implements the LFUN behaviour. If the search goes beyond buffer boundary, lyxfind.cpp queries the user (buffer().message() or smth. like that) for knowing if he wants to continue searching

Now I describe what I would like to have:
1. GUI dispatches LFUN
2. lyxfind.cpp performs a search attempt, but it does not necessarily complete the search, nor it triggers a user-interface interaction (which would be smth. to avoid IMHO, at the "model" level, at least if possible). Instead, the action provides a "LFUN response" with multiple possible values, for example:
1) search finished
2) search not yet finished, but arrived only up to a certain point (so another LFUN dispatch would continue the search) 3) end of current scope reached (so the GUI would ask the user what to do next)

I really wouldn't know where to store such an information, for subsequent retrieval from the GUI (but, I know I could simply add some field and methods to the LyXView for that -- someth. I feel like the way not to go). Now, I need such a "backwards communication" from the model to the GUI in order to implement a "Stop" button. The GUI needs to be "live" while the model is searching, and for each LFUN re-dispatch, it needs to know whether the search was finished or not, in order to disable the "Stop" button when the search is over. Furthermore, if it's the GUI to query the user, then it may have more control over how the focus changes when the user interacts with the dialog. Currently, after the question, the focus is on the document WA and not more on the search WA, what causes the erase of the selected match right after the question (about keeping searching from beginning) when keeping to type "Enter".

Hope this clarifies. Please, note that, for implementing the "Stop" button, I would need a further feature (a background action to attach to the application or lyxview), but this is another story... [ and I'm trying to stick to the current single-thread application model of course ]

Feel free to propose alternatives. Thanks,

   T.

Reply via email to