"Bo Peng" <[EMAIL PROTECTED]> writes: | Index: src/BufferView_pimpl.C | =================================================================== | --- src/BufferView_pimpl.C (revision 13495) | +++ src/BufferView_pimpl.C (working copy) | @@ -293,9 +303,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; | + } | + } | + }
This should be refactored. | | if (tolastfiles) | - LyX::ref().lastfiles().newFile(b->fileName()); | + LyX::ref().session().addLastFile(b->fileName()); | | return true; | } | Index: src/frontends/gtk/GView.C | =================================================================== | --- src/frontends/gtk/GView.C (revision 13495) | +++ src/frontends/gtk/GView.C (working copy) | @@ -117,6 +117,14 @@ | | bool GView::on_delete_event(GdkEventAny * /*event*/) | { | + // FIXME | + // for qt, this has been changed to the following code | + // Similar change to the GTK frontend may be needed. | + // | + // trigger LFUN_QUIT instead of quit directly | + // since LFUN_QUIT may have more cleanup stuff | + // | + // getLyXFunc().dispatch(FuncRequest(LFUN_QUIT)); | QuitLyX(false); | return true; Why not just change it. Can it harm? | Index: src/frontends/xforms/XFormsView.C | =================================================================== | --- src/frontends/xforms/XFormsView.C (revision 13495) | +++ src/frontends/xforms/XFormsView.C (working copy) | @@ -173,6 +173,14 @@ | // Callback for close main form from window manager | int XFormsView::atCloseMainFormCB(FL_FORM *, void *) | { | + // FIXME | + // for qt, this has been changed to the following code | + // Similar change to the xform frontend may be needed. | + // | + // trigger LFUN_QUIT instead of quit directly | + // since LFUN_QUIT may have more cleanup stuff | + // | + // getLyXFunc().dispatch(FuncRequest(LFUN_QUIT)); | QuitLyX(false); | return FL_IGNORE; | } ditto -- Lgb