Bo Peng wrote:
>> Yes:
>>
>> dispatch(FuncRequest(LFUN_BUFFER_SWITCH, _name_of_the_buffer))
>
> No.
If that is so then that is wrong and should be corrected.
> BufferBiew::dispatch() does not pass the signal to LyXView.
We should not even go to BufferBiew::dispatch(), only
LyXView::dispatch() that then call LyXView::setBuffer() and then
BufferView::setBuffer().
>
> Will something like attached be accepted? Basically, I move
> LFUN_BOOKMARK_GOTO to lyxfunc.C and swith buffer via LyxView instead
> of BufferView. A relocation of the whole bookmark feature may worth
> further consideration though.
If this is the only way to implement that correctly in a multi-window
context then let's do it.
> How to test:
>
> Open two documents, save bookmark, switch to another document, go to
> saved bookmark. Currently, buffer switches without window title (and
> other) change. The attached patch seems to fix this.
I will fix this bug by correcting the LFUN dispatch like stated above.
> Abdel: is this something you can fix?
> Open lyx, load a document, save bookmark, open another window,
> bookmarks are disabled. I thik even if 'save bookmark' does not work
> without a buffer, "goto bookmark" should, when a valid bookmark
> exists.
I guess I can fix it. The problems lies in the menu backend and lyxview
interaction.
>
> Index: src/lyxfunc.C
> ===================================================================
> --- src/lyxfunc.C (revision 15595)
> +++ src/lyxfunc.C (working copy)
> @@ -1660,6 +1660,16 @@
> // We return here because lyx_view does not
> exists anymore.
> return;
>
> + case LFUN_BOOKMARK_GOTO: {
> + unsigned int id = convert<unsigned
> int>(to_utf8(cmd.argument()));
> + string const & fname =
> view()->filenameOfSavedPosition(id);
Hum this looks wrong. BufferView is attached to a single Buffer thus a
single Filename.
> + if (lyx_view_->buffer()->fileName() != fname)
> +
> dispatch(FuncRequest(LFUN_BUFFER_SWITCH, fname));
> + // now, we restore cursor location
> + view()->restorePosition(id);
> + break;
> + }
This looks wrong also Bo. We should reuse the LFUN_GOTO functionality
instead a new method. IMHO should not be stored in BufferView but either
in a separate object or directly in Buffer.
Abdel.