]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
Fix bug #6744: Crash when copying an inset from a deleted section.
[lyx.git] / src / Buffer.cpp
index dad081932be7661be9b8926fcd426e0fb73791b7..98fdc287a6542f09d27f72ded17d4eadb7a6c5de 100644 (file)
 #include "support/textutils.h"
 #include "support/types.h"
 
-#include <boost/bind.hpp>
-#include <boost/shared_ptr.hpp>
+#include "support/bind.h"
+#include "support/shared_ptr.h"
 
 #include <algorithm>
 #include <fstream>
@@ -126,7 +126,7 @@ namespace {
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-int const LYX_FORMAT = 386; // rgh: LyX version for InsetInfo
+int const LYX_FORMAT = 390; // ps: forward view
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
@@ -553,7 +553,7 @@ string Buffer::latexName(bool const no_path) const
 FileName Buffer::Impl::exportFileName() const
 {
        docstring const branch_suffix =
-               params.branchlist().getFilenameSuffix();
+               params.branchlist().getFileNameSuffix();
        if (branch_suffix.empty())
                return filename;
 
@@ -673,6 +673,10 @@ int Buffer::readHeader(Lexer & lex)
        params().isfontcolor = false;
        params().notefontcolor = lyx::rgbFromHexName("#cccccc");
        params().boxbgcolor = lyx::rgbFromHexName("#ff0000");
+       params().html_latex_start.clear();
+       params().html_latex_end.clear();
+       params().html_math_img_scale = 1.0;
+       params().output_sync_macro.erase();
 
        for (int i = 0; i < 4; ++i) {
                params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
@@ -771,7 +775,7 @@ bool Buffer::readDocument(Lexer & lex)
        if (!params().master.empty()) {
                FileName const master_file = makeAbsPath(params().master,
                           onlyPath(absFileName()));
-               if (isLyXFilename(master_file.absFileName())) {
+               if (isLyXFileName(master_file.absFileName())) {
                        Buffer * master = 
                                checkAndLoadLyXFile(master_file, true);
                        if (master) {
@@ -1006,6 +1010,7 @@ bool Buffer::save() const
                        backupName = FileName(addName(lyxrc.backupdir_path,
                                                      mangledName));
                }
+               // do not copy because of #6587
                if (fileName().moveTo(backupName)) {
                        madeBackup = true;
                } else {
@@ -1656,7 +1661,7 @@ void Buffer::validate(LaTeXFeatures & features) const
        updateMacros();
 
        for_each(paragraphs().begin(), paragraphs().end(),
-                boost::bind(&Paragraph::validate, _1, boost::ref(features)));
+                bind(&Paragraph::validate, _1, ref(features)));
 
        if (lyxerr.debugging(Debug::LATEX)) {
                features.showStruct();
@@ -3067,9 +3072,9 @@ public:
        AutoSaveBuffer(Buffer const & buffer, FileName const & fname)
                : buffer_(buffer), fname_(fname) {}
        ///
-       virtual boost::shared_ptr<ForkedProcess> clone() const
+       virtual shared_ptr<ForkedProcess> clone() const
        {
-               return boost::shared_ptr<ForkedProcess>(new AutoSaveBuffer(*this));
+               return shared_ptr<ForkedProcess>(new AutoSaveBuffer(*this));
        }
        ///
        int start()
@@ -3141,7 +3146,7 @@ int AutoSaveBuffer::generateChild()
 } // namespace anon
 
 
-FileName Buffer::getAutosaveFilename() const
+FileName Buffer::getAutosaveFileName() const
 {
        // if the document is unnamed try to save in the backup dir, else
        // in the default document path, and as a last try in the filePath, 
@@ -3160,7 +3165,7 @@ FileName Buffer::getAutosaveFilename() const
 
 void Buffer::removeAutosaveFile() const
 {
-       FileName const f = getAutosaveFilename();
+       FileName const f = getAutosaveFileName();
        if (f.exists())
                f.removeFile();
 }
@@ -3168,7 +3173,7 @@ void Buffer::removeAutosaveFile() const
 
 void Buffer::moveAutosaveFile(support::FileName const & oldauto) const
 {
-       FileName const newauto = getAutosaveFilename();
+       FileName const newauto = getAutosaveFileName();
        oldauto.refresh();
        if (newauto != oldauto && oldauto.exists())
                if (!oldauto.moveTo(newauto))
@@ -3187,7 +3192,7 @@ void Buffer::autoSave() const
 
        // emit message signal.
        message(_("Autosaving current document..."));
-       AutoSaveBuffer autosave(*this, getAutosaveFilename());
+       AutoSaveBuffer autosave(*this, getAutosaveFileName());
        autosave.start();
 
        d->bak_clean = true;
@@ -3961,6 +3966,7 @@ bool Buffer::reload()
        if (success) {
                updateBuffer();
                changed(true);
+               updateTitles();
                markClean();
                message(bformat(_("Document %1$s reloaded."), disp_fn));
        } else {