Tommaso Cucinotta schreef:
... continuing ...

In LyXFunc::dispatch():

L950:
       case LFUN_BUILD_PROGRAM:
           LASSERT(lyx_view_ && buffer, /**/);
           buffer->doExport("program", true);
           break;

       case LFUN_BUFFER_CHKTEX:
           LASSERT(lyx_view_ && buffer, /**/);
           buffer->runChktex();
           break;

       case LFUN_BUFFER_EXPORT:
           LASSERT(lyx_view_ && buffer, /**/);
           if (argument == "custom")
               dispatch(FuncRequest(LFUN_DIALOG_SHOW, "sendto"));
           else
               buffer->doExport(argument, false);
           break;

       case LFUN_BUFFER_EXPORT_CUSTOM: {
           LASSERT(lyx_view_ && buffer, /**/);

isn't it 'doc_buffer' instead of 'buffer', in all of the above ?

Also here:

       case LFUN_BUFFER_AUTO_SAVE:
           buffer->autoSave();
           break;

L1053:

       // --- version control -------------------------------
       case LFUN_VC_REGISTER:
           LASSERT(lyx_view_ && buffer, /**/);
           if (!ensureBufferClean(lyx_view_->documentBufferView()))

and following VC_* LFUNs, all asserts are on buffer ( == current), but code seems to work on documentBuffer.

L1313:
       case LFUN_BUFFER_CHILD_OPEN: {
           LASSERT(lyx_view_ && buffer, /**/);
           FileName filename = makeAbsPath(argument, buffer->filePath());
           lyx_view_->documentBufferView()->saveBookmark(false);

Guess we want to open the child of the doc_buffer, don't we ? ('buffer' ==> 'doc_buffer')

L1384:

       case LFUN_COMMAND_SEQUENCE: {
           // argument contains ';'-terminated commands
           string arg = argument;
           if (theBufferList().isLoaded(buffer))
               buffer->undo().beginUndoGroup();
           while (!arg.empty()) {
               string first;
               arg = split(arg, first, ';');
               FuncRequest func(lyxaction.lookupFunc(first));
               func.origin = cmd.origin;
               dispatch(func);
           }
           if (theBufferList().isLoaded(buffer))
               buffer->undo().endUndoGroup();
           break;
       }

we don't know if the sequence of LFUN is going to affect what buffer (or both ?), so perhaps we want to do beginUndoGroup() and endUndoGroup() on both 'buffer' and 'doc_buffer' (if they are != 0 and isLoaded()) ?

After the while() loop dispatching LFUNs, I can't imagine what may happen (but this may not be allowed to happen of course) if one of those LFUNs closed the current or document buffer.

L1520:

       case LFUN_LAYOUT_MODULES_CLEAR: {
           LASSERT(lyx_view_ && lyx_view_->documentBufferView(), /**/);
DocumentClass const * const oldClass = buffer->params().documentClassPtr(); lyx_view_->documentBufferView()->cursor().recordUndoFullDocument();
           buffer->params().clearLayoutModules();
           buffer->params().makeDocumentClass();

half code working on doc_buffer, half on buffer ?

Same question on LFUN_LAYOUT_MODULE_ADD, and LFUN_TEXTCLASS_APPLY

L1631:
       case LFUN_VC_COMMAND: {
           string flag = cmd.getArg(0);
           if (buffer && contains(flag, 'R')
               && !ensureBufferClean(lyx_view_->documentBufferView()))
               break;

mix of buffer and documentBV() ?

finally, L1674:

default:
...
           if (theBufferList().isLoaded(buffer))
               buffer->undo().beginUndoGroup();

and later, all dispatch goes to currentBV() and/or current buffer (I think).

Hope these comments help (apologies for the length, it was not expected).

   T.

I did expect. Actually I listed a long list of LFUNS in LyXFunc which should work on the document buffer long ago. After this, only the calls to view() have been altered and Abdel didn't look at any of the buffers (I think).

I think we should really move around a lot of the LFUNS in LyXFunc. All LFUNS that need a LyXView needs to be moved to GuiView... right ? LyXFunc should be able to operate without any GUI (ok it can, but it should not have functionality depending on the GUI).

LFUN_WORD_FIND_FORWARD
LFUN_WORD_FIND_BACKWARD
-> to BufferView, to joins its friends LFUN_WORD_FIND, etc...

LFUN_COMMAND_PREFIX
-> to GuiView

LFUN_BUFFER_TOGGLE_READ_ONLY
-> to BufferView if we have the LFUN_option otherwise GuiView

LFUN_BUFFER_CLOSE
-> to GuiView

etc.

All LFUNS that go to BufferView automatically get the correct one..

Or, I am missing something, or we can move masses of these LFUNS.

VIncent

Reply via email to