]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
* gcc does not like missing characters in keywords
[lyx.git] / src / Buffer.cpp
index e50a9745096ba590bb90211c2da9624eb51add46..192113da7dafdbf1163bb8efc9019c024a464757 100644 (file)
@@ -156,7 +156,7 @@ namespace fs = boost::filesystem;
 
 namespace {
 
-int const LYX_FORMAT = 295; //Uwe: htmlurl, href
+int const LYX_FORMAT = 297; //Uwe: Albanian, lower Sorbian
 
 } // namespace anon
 
@@ -431,7 +431,7 @@ void Buffer::setReadonly(bool const flag)
 {
        if (pimpl_->read_only != flag) {
                pimpl_->read_only = flag;
-               readonly(flag);
+               setReadOnly(flag);
        }
 }
 
@@ -570,8 +570,6 @@ bool Buffer::readDocument(Lexer & lex)
                                         "\\lyxadded and \\lyxdeleted in the LaTeX preamble."));
                }
        }
-       // read manifest after header
-       embeddedFiles().readManifest(lex, errorList);   
 
        // read main text
        bool const res = text().read(*this, lex, errorList);
@@ -962,12 +960,6 @@ bool Buffer::write(ostream & ofs) const
        params().writeFile(ofs);
        ofs << "\\end_header\n";
 
-       // write the manifest after header
-       ofs << "\n\\begin_manifest\n";
-       pimpl_->embedded_files.update();
-       embeddedFiles().writeManifest(ofs);
-       ofs << "\\end_manifest\n";
-
        // write the text
        ofs << "\n\\begin_body\n";
        text().write(*this, ofs);
@@ -1814,6 +1806,7 @@ void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
        // Check if the label 'from' appears more than once
        vector<docstring> labels;
 
+       string paramName;
        if (code == CITE_CODE) {
                BiblioInfo keys;
                keys.fillWithBibKeys(this);
@@ -1823,8 +1816,11 @@ void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
                for (; bit != bend; ++bit)
                        // FIXME UNICODE
                        labels.push_back(bit->first);
-       } else
+               paramName = "key";
+       } else {
                getLabelList(labels);
+               paramName = "reference";
+       }
 
        if (std::count(labels.begin(), labels.end(), from) > 1)
                return;
@@ -1832,7 +1828,9 @@ void Buffer::changeRefsIfUnique(docstring const & from, docstring const & to,
        for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
                if (it->lyxCode() == code) {
                        InsetCommand & inset = static_cast<InsetCommand &>(*it);
-                       inset.replaceContents(to_utf8(from), to_utf8(to));
+                       docstring const oldValue = inset.getParam(paramName);
+                       if (oldValue == from)
+                               inset.setParam(paramName, to);
                }
        }
 }
@@ -1908,13 +1906,6 @@ void Buffer::structureChanged() const
 }
 
 
-void Buffer::embeddingChanged() const
-{
-       if (gui_)
-               gui_->embeddingChanged();
-}
-
-
 void Buffer::errors(std::string const & err) const
 {
        if (gui_)
@@ -1932,14 +1923,14 @@ void Buffer::message(docstring const & msg) const
 void Buffer::setBusy(bool on) const
 {
        if (gui_)
-               gui_->busy(on);
+               gui_->setBusy(on);
 }
 
 
-void Buffer::readonly(bool on) const
+void Buffer::setReadOnly(bool on) const
 {
        if (gui_)
-               gui_->readonly(on);
+               gui_->setReadOnly(on);
 }
 
 
@@ -2092,12 +2083,10 @@ bool Buffer::writeAs(string const & newname)
        if (newname.empty()) {  /// No argument? Ask user through dialog
 
                // FIXME UNICODE
-               FileDialog fileDlg(_("Choose a filename to save document as"),
-                                  LFUN_BUFFER_WRITE_AS,
-                                  make_pair(_("Documents|#o#O"), 
-                                            from_utf8(lyxrc.document_path)),
-                                  make_pair(_("Templates|#T#t"), 
-                                            from_utf8(lyxrc.template_path)));
+               FileDialog dlg(_("Choose a filename to save document as"),
+                                  LFUN_BUFFER_WRITE_AS);
+               dlg.setButton1(_("Documents|#o#O"), from_utf8(lyxrc.document_path));
+               dlg.setButton2(_("Templates|#T#t"), from_utf8(lyxrc.template_path));
 
                if (!support::isLyXFilename(fname))
                        fname += ".lyx";
@@ -2105,7 +2094,7 @@ bool Buffer::writeAs(string const & newname)
                support::FileFilterList const filter(_("LyX Documents (*.lyx)"));
 
                FileDialog::Result result =
-                       fileDlg.save(from_utf8(onlyPath(fname)),
+                       dlg.save(from_utf8(onlyPath(fname)),
                                     filter,
                                     from_utf8(onlyFilename(fname)));
 
@@ -2188,7 +2177,7 @@ void Buffer::loadChildDocuments() const
        for (InsetIterator it = inset_iterator_begin(inset()); it; ++it) {
                if (it->lyxCode() != INCLUDE_CODE)
                        continue;
-               InsetInclude const & inset = static_cast<InsetInclude const &>(*it);
+               InsetCommand const & inset = static_cast<InsetCommand const &>(*it);
                InsetCommandParams const & ip = inset.params();
                Buffer * child = loadIfNeeded(*this, ip);
                if (!child)
@@ -2212,8 +2201,8 @@ string Buffer::bufferFormat() const
 }
 
 
-bool Buffer::doExport(string const & format,
-       bool put_in_tempdir, string & result_file)
+bool Buffer::doExport(string const & format, bool put_in_tempdir,
+       string & result_file)
 {
        string backend_format;
        OutputParams runparams(&params().encoding());