]> git.lyx.org Git - lyx.git/blobdiff - src/buffer.C
partial framebox support
[lyx.git] / src / buffer.C
index 29fff0e6124a3a5e870e97373afd64750f1e613a..5d4745abbe76e9820e66d76f30f0eceeb3df3807 100644 (file)
@@ -73,6 +73,7 @@
 #include "insets/insetgraphics.h"
 #include "insets/insetfoot.h"
 #include "insets/insetmarginal.h"
+#include "insets/insetoptarg.h"
 #include "insets/insetminipage.h"
 #include "insets/insetfloat.h"
 #include "insets/insettabular.h"
@@ -146,7 +147,7 @@ extern BufferList bufferlist;
 
 namespace {
 
-const int LYX_FORMAT = 220;
+const int LYX_FORMAT = 221;
 
 } // namespace anon
 
@@ -156,14 +157,7 @@ Buffer::Buffer(string const & file, bool ronly)
          filename_(file), users(0), ctrs(new Counters)
 {
        lyxerr[Debug::INFO] << "Buffer::Buffer()" << endl;
-//     filename = file;
        filepath_ = OnlyPath(file);
-//     lyx_clean = true;
-//     bak_clean = true;
-//     dep_clean = 0;
-//     read_only = ronly;
-//     unnamed = false;
-//     users = 0;
        lyxvc.buffer(this);
        if (read_only || lyxrc.use_tempdir) {
                tmppath = CreateBufferTmpDir();
@@ -1115,6 +1109,8 @@ void Buffer::readInset(LyXLex & lex, Paragraph *& par,
                        inset = new InsetFoot(params);
                } else if (tmptok == "Marginal") {
                        inset = new InsetMarginal(params);
+               } else if (tmptok == "OptArg") {
+                       inset = new InsetOptArg(params);
                } else if (tmptok == "Minipage") {
                        inset = new InsetMinipage(params);
                } else if (tmptok == "Float") {
@@ -1158,6 +1154,7 @@ bool Buffer::readFile(LyXLex & lex, Paragraph * par)
                        if (dot != string::npos)
                                tmp_format.erase(dot, 1);
                        file_format = strToInt(tmp_format);
+                       //lyxerr << "format: " << file_format << endl;
                        if (file_format == LYX_FORMAT) {
                                // current format
                        } else if (file_format > LYX_FORMAT) {
@@ -1173,7 +1170,7 @@ bool Buffer::readFile(LyXLex & lex, Paragraph * par)
                                                   _("Old LyX file format found. "
                                                     "Use LyX 0.10.x to read this!"));
                                        return false;
-                               } else if (file_format < 220) {
+                               } else {
                                        string const command = "lyx2lyx "
                                                + QuoteName(filename_);
                                        cmd_ret const ret = RunCommand(command);
@@ -3214,20 +3211,21 @@ vector<pair<string, string> > const Buffer::getBibkeyList() const
                }
        }
 
+       if (!keys.empty())
+               return keys;
        // Might be either using bibtex or a child has bibliography
-       if (keys.empty()) {
-               for (inset_iterator it = inset_const_iterator_begin();
-                       it != inset_const_iterator_end(); ++it) {
-                       // Search for Bibtex or Include inset
-                       if (it->lyxCode() == Inset::BIBTEX_CODE) {
-                               vector<StringPair> tmp =
-                                       static_cast<InsetBibtex &>(*it).getKeys(this);
-                               keys.insert(keys.end(), tmp.begin(), tmp.end());
-                       } else if (it->lyxCode() == Inset::INCLUDE_CODE) {
-                               vector<StringPair> const tmp =
-                                       static_cast<InsetInclude &>(*it).getKeys();
-                               keys.insert(keys.end(), tmp.begin(), tmp.end());
-                       }
+       for (inset_iterator it = inset_const_iterator_begin();
+               it != inset_const_iterator_end(); ++it) {
+               // Search for Bibtex or Include inset
+               if (it->lyxCode() == Inset::BIBTEX_CODE) {
+                       vector<StringPair> tmp =
+                               static_cast<InsetBibtex &>(*it).getKeys(this);
+                       keys.insert(keys.end(), tmp.begin(), tmp.end());
+               } else if (it->lyxCode() == Inset::INCLUDE_CODE) {
+                       vector<StringPair> const tmp =
+                               static_cast<InsetInclude &>(*it).getKeys();
+                       keys.insert(keys.end(), tmp.begin(), tmp.end());
                }
        }