]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.cpp
* Paragraph: reserve memory by chunks of 100 chars. This improve the loading of big...
[lyx.git] / src / BufferView.cpp
index 117ae94c40c5762faf5841f593b81d6f80389365..2b6820949c4ec46b6b44fc7e460fb1858ec11e3f 100644 (file)
@@ -25,6 +25,7 @@
 #include "CutAndPaste.h"
 #include "debug.h"
 #include "DispatchResult.h"
+#include "EmbeddedFiles.h"
 #include "ErrorList.h"
 #include "factory.h"
 #include "FloatList.h"
@@ -420,7 +421,7 @@ BufferView::~BufferView()
        // That is to say, if a cursor is in a nested inset, it will be
        // restore to the left of the top level inset.
        LyX::ref().session().lastFilePos().save(
-               support::FileName(buffer_.fileName()),
+               support::FileName(buffer_.absFileName()),
                boost::tie(d->cursor_.bottom().pit(), d->cursor_.bottom().pos()) );
 
        delete d;
@@ -721,7 +722,7 @@ void BufferView::saveBookmark(unsigned int idx)
        // pit and pos will be updated with bottom level pit/pos
        // when lyx exits.
        LyX::ref().session().bookmarks().save(
-               FileName(buffer_.fileName()),
+               FileName(buffer_.absFileName()),
                d->cursor_.bottom().pit(),
                d->cursor_.bottom().pos(),
                d->cursor_.paragraph().id(),
@@ -917,6 +918,11 @@ FuncStatus BufferView::getStatus(FuncRequest const & cmd)
                flag.setOnOff(buffer_.params().compressed);
                break;
        }
+       
+       case LFUN_BUFFER_TOGGLE_EMBEDDING: {
+               flag.setOnOff(buffer_.params().embedded);
+               break;
+       }
 
        case LFUN_SCREEN_UP:
        case LFUN_SCREEN_DOWN:
@@ -1086,7 +1092,7 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
                                LYXERR(Debug::INFO)
                                        << "Paragraph " << par->id()
                                        << " found in buffer `"
-                                       << b->fileName() << "'." << endl;
+                                       << b->absFileName() << "'." << endl;
 
                                if (b == &buffer_) {
                                        // Set the cursor
@@ -1094,7 +1100,7 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
                                } else {
                                        // Switch to other buffer view and resend cmd
                                        theLyXFunc().dispatch(FuncRequest(
-                                               LFUN_BUFFER_SWITCH, b->fileName()));
+                                               LFUN_BUFFER_SWITCH, b->absFileName()));
                                        theLyXFunc().dispatch(cmd);
                                        updateFlags = Update::None;
                                }
@@ -1298,6 +1304,11 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
                // turn compression on/off
                buffer_.params().compressed = !buffer_.params().compressed;
                break;
+       
+       case LFUN_BUFFER_TOGGLE_EMBEDDING:
+               // turn embedding on/off
+               buffer_.embeddedFiles().enable(!buffer_.params().embedded);
+               break;
 
        case LFUN_NEXT_INSET_TOGGLE: {
                // this is the real function we want to invoke
@@ -1966,7 +1977,7 @@ void BufferView::menuInsertLyXFile(string const & filenm)
 
        docstring res;
        Buffer buf("", false);
-       if (lyx::loadLyXFile(&buf, FileName(filename))) {
+       if (buf.loadLyXFile(FileName(filename))) {
                ErrorList & el = buffer_.errorList("Parse");
                // Copy the inserted document error list into the current buffer one.
                el = buf.errorList("Parse");
@@ -1974,8 +1985,9 @@ void BufferView::menuInsertLyXFile(string const & filenm)
                cap::pasteParagraphList(d->cursor_, buf.paragraphs(),
                                             buf.params().getTextClassPtr(), el);
                res = _("Document %1$s inserted.");
-       } else
+       } else {
                res = _("Could not insert document %1$s");
+       }
 
        // emit message signal.
        message(bformat(res, disp_fn));