"Bo Peng" <[EMAIL PROTECTED]> writes:

| @@ -101,7 +101,7 @@
|  bool MenuWrite(Buffer * buffer)
|  {
|       if (buffer->save()) {
| -             LyX::ref().lastfiles().newFile(buffer->fileName());
| +             LyX::ref().session().addLastFile(buffer->fileName());
|               return true;
|       }

I like the name change.

| Index: src/BufferView_pimpl.C
| ===================================================================
| --- src/BufferView_pimpl.C    (revision 13486)
| +++ src/BufferView_pimpl.C    (working copy)
| @@ -42,7 +42,7 @@
|  #include "lyxfunc.h"
|  #include "lyxtext.h"
|  #include "lyxrc.h"
| -#include "lastfiles.h"
| +#include "session.h"
|  #include "metricsinfo.h"
|  #include "paragraph.h"
|  #include "paragraph_funcs.h"
| @@ -293,9 +293,30 @@
|  
|       setBuffer(b);
|       bv_->showErrorList(_("Parse"));
| +        
| +     // scroll to the position when the file was last closed
| +     if (lyxrc.use_lastfilepos) {
| +             lyx::pit_type pit;
| +             lyx::pos_type pos;
| +             boost::tie(pit, pos) = LyX::ref().session().loadFilePosition(s);
| +             // move to the beginning of that paragraph
| +             // be careful since the file may have been externally changed 
...
| +             if ( static_cast<size_t>(pit) < b->paragraphs().size() ) {
| +                     // paragraphs is now RandomAccessList 
| +                     // so simple paragraphs[pit] is not allowed.
| +                     ParIterator it = b->par_iterator_begin();
| +                     ParIterator const end = b->par_iterator_end();
| +                     for (; it != end; ++it)
| +                             if (it.pit() == pit) {
| +                                     bv_->setCursor(makeDocIterator(it, 
pos));
| +                                     bv_->update(Update::FitCursor);
| +                                     break;
| +                             }
| +             }
| +     }


DocIterator findDocIterator(lyx::pit_type pit, lyx::pos_type pos)
{
        // Iterate over full document and discover the correct
        // iterator to return.
        // ( I wonder... is this very similar to what the brute find
        //   functions does?)
        return found_iterator;
}


        // Place the cursor at the position where the file was last closed
        if (lyxrc.use_lastfilepos) {
                Session & sess = LyX::ref().session();
                lyx::pit_type pit;
                lyx::pos_type pos;
                boost::tie(pit, pos) = sess.loadFilePosition(s);
                DocIterator dit = findDocIterator(pit, pos);
                if (dit != doc_iterator_end) {
                        bv_->setCursor(dit);
                        bv_->update(Update::FitCursor);
                }
        }

|       // If we are closing current buffer, switch to the first in
| Index: src/session.C
| ===================================================================
| --- src/session.C     (revision 0)
| +++ src/session.C     (revision 0)
| @@ -0,0 +1,193 @@
| +/**
| + * \file session.C
| + * This file is part of LyX, the document processor.
| + * Licence details can be found in the file COPYING.
| + *
| + * \author Lars Gullik Bjønnes, Bo Peng

On two lines bitte please.

-- 
        Lgb

Reply via email to