]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
A GUI for nomencl settings. Adds the possibility to enter a custom length.
[lyx.git] / src / Buffer.cpp
index cdc45a6dde11f873761b34439696e66ad0e0a5b6..d9d9547df5d00f26556036b5e141fd24718756d5 100644 (file)
@@ -125,7 +125,7 @@ namespace {
 
 // Do not remove the comment below, so we get merge conflict in
 // independent branches. Instead add your own.
-int const LYX_FORMAT = 354;  // jspitzm: support for \print[sub]index*
+int const LYX_FORMAT = 360;  // jspitzm: nomencl custom width
 
 typedef map<string, bool> DepClean;
 typedef map<docstring, pair<InsetLabel const *, Buffer::References> > RefCache;
@@ -525,6 +525,7 @@ int Buffer::readHeader(Lexer & lex)
        params().clearRemovedModules();
        params().pdfoptions().clear();
        params().indiceslist().clear();
+       params().backgroundcolor = lyx::rgbFromHexName("#ffffff");
 
        for (int i = 0; i < 4; ++i) {
                params().user_defined_bullet(i) = ITEMIZE_DEFAULTS[i];
@@ -2607,7 +2608,16 @@ int AutoSaveBuffer::generateChild()
 
 FileName Buffer::getAutosaveFilename() const
 {
-       string const fpath = isUnnamed() ? lyxrc.document_path : filePath();
+       // 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, 
+       // which will most often be the temporary directory
+       string fpath;
+       if (isUnnamed())
+               fpath = lyxrc.backupdir_path.empty() ? lyxrc.document_path
+                       : lyxrc.backupdir_path;
+       if (!isUnnamed() || fpath.empty() || !FileName(fpath).exists())
+               fpath = filePath();
+
        string const fname = "#" + d->filename.onlyFileName() + "#";
        return makeAbsPath(fname, fpath);
 }
@@ -2621,6 +2631,14 @@ void Buffer::removeAutosaveFile() const
 }
 
 
+void Buffer::moveAutosaveFile(support::FileName const & oldauto) const
+{
+       FileName const newauto = getAutosaveFilename();
+       if (!(oldauto == newauto || oldauto.moveTo(newauto)))
+               LYXERR0("Unable to remove autosave file `" << oldauto << "'!");
+}
+
+
 // Perfect target for a thread...
 void Buffer::autoSave() const
 {