]> git.lyx.org Git - lyx.git/blobdiff - src/BufferList.cpp
adjust
[lyx.git] / src / BufferList.cpp
index 0a776240e66aeb9b20c827ada77bddab493bf732..d4dfbdbf642eb42e362b7338d0e93d3d6c155281 100644 (file)
 #include "debug.h"
 #include "gettext.h"
 #include "Session.h"
-#include "lyx_cb.h"
 #include "LyX.h"
 #include "output_latex.h"
-#include "Paragraph.h"
 #include "ParagraphList.h"
 
-#include "frontends/Alert.h"
+#include "frontends/alert.h"
 
 #include "support/filetools.h"
 #include "support/Package.h"
 #include <algorithm>
 #include <functional>
 
-
-namespace lyx {
-
-using support::addName;
-using support::bformat;
-using support::FileName;
-using support::makeDisplayPath;
-using support::onlyFilename;
-using support::removeAutosaveFile;
-using support::package;
-using support::prefixIs;
-
 using boost::bind;
 
 using std::auto_ptr;
@@ -59,6 +45,18 @@ using std::vector;
 using std::back_inserter;
 using std::transform;
 
+
+namespace lyx {
+
+using support::addName;
+using support::bformat;
+using support::FileName;
+using support::makeDisplayPath;
+using support::onlyFilename;
+using support::removeAutosaveFile;
+using support::package;
+using support::prefixIs;
+
 namespace Alert = lyx::frontend::Alert;
 
 
@@ -120,9 +118,9 @@ bool BufferList::quitWriteBuffer(Buffer * buf)
                bool succeeded;
 
                if (buf->isUnnamed())
-                       succeeded = writeAs(buf);
+                       succeeded = buf->writeAs();
                else
-                       succeeded = menuWrite(buf);
+                       succeeded = buf->menuWrite();
 
                if (!succeeded)
                        return false;
@@ -223,18 +221,14 @@ bool BufferList::close(Buffer * buf, bool const ask)
 
        if (ret == 0) {
                if (buf->isUnnamed()) {
-                       if (!writeAs(buf))
+                       if (!buf->writeAs())
                                return false;
-               } else if (!menuWrite(buf))
-                       return false;
-               else
+               } else if (!buf->menuWrite())
                        return false;
        } else if (ret == 2)
                return false;
-
-       if (buf->isUnnamed()) {
-               removeAutosaveFile(buf->fileName());
-       }
+               
+       removeAutosaveFile(buf->fileName());
 
        release(buf);
        return true;
@@ -267,7 +261,7 @@ Buffer * BufferList::last()
 }
 
 
-Buffer * BufferList::getBuffer(unsigned int const choice)
+Buffer * BufferList::getBuffer(unsigned int choice)
 {
        if (choice >= bstore.size())
                return 0;
@@ -335,7 +329,9 @@ void BufferList::emergencyWrite(Buffer * buf)
 {
        // Use ::assert to avoid a loop, BOOST_ASSERT ends up calling ::assert
        // compare with 0 to avoid pointer/interger comparison
-       assert(buf != 0);
+       // ::assert(buf != 0);
+       if (!buf)
+               return;
 
        // No need to save if the buffer has not changed.
        if (buf->isClean())