]> git.lyx.org Git - lyx.git/blobdiff - src/Buffer.cpp
* gcc does not like missing characters in keywords
[lyx.git] / src / Buffer.cpp
index 8e87ecbce23bf0ac8fd4677729b3a8219cdb739c..192113da7dafdbf1163bb8efc9019c024a464757 100644 (file)
@@ -156,7 +156,7 @@ namespace fs = boost::filesystem;
 
 namespace {
 
-int const LYX_FORMAT = 296; //RGH: InsetInclude changes
+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);
        }
 }
 
@@ -1806,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);
@@ -1815,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;
@@ -1824,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);
                }
        }
 }
@@ -1917,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);
 }
 
 
@@ -2077,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";
@@ -2090,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)));
 
@@ -2197,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());