]> git.lyx.org Git - features.git/commitdiff
Backport r38743-4. This is cleanup, prior to serious work on Buffer::clone().
authorRichard Heck <rgheck@comcast.net>
Fri, 13 May 2011 22:39:21 +0000 (22:39 +0000)
committerRichard Heck <rgheck@comcast.net>
Fri, 13 May 2011 22:39:21 +0000 (22:39 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@38745 a592a061-630c-0410-9148-cb99ea01b6c8

15 files changed:
src/Buffer.cpp
src/Buffer.h
src/BufferParams.cpp
src/BufferParams.h
src/Converter.cpp
src/frontends/qt4/Dialog.cpp
src/frontends/qt4/GuiDocument.cpp
src/frontends/qt4/GuiSendto.cpp
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiViewSource.cpp
src/frontends/qt4/Menus.cpp
src/graphics/PreviewLoader.cpp
src/insets/InsetInclude.cpp
src/insets/InsetRef.cpp
src/lyxfind.cpp

index 45cd9dbdc6f0f3d1c4d6a4ac99c57ada75eed43b..f51084e8ef2ebf7db43bf46aea033c1c736cc240 100644 (file)
@@ -597,7 +597,7 @@ string Buffer::logName(LogType * type) const
        FileName const bname(
                addName(path, onlyFileName(
                        changeExtension(filename,
-                                       formats.extension(bufferFormat()) + ".out"))));
+                                       formats.extension(params().bufferFormat()) + ".out"))));
 
        // Also consider the master buffer log file
        FileName masterfname = fname;
@@ -1477,24 +1477,6 @@ void Buffer::writeLaTeXSource(otexstream & os,
 }
 
 
-bool Buffer::isLatex() const
-{
-       return params().documentClass().outputType() == LATEX;
-}
-
-
-bool Buffer::isLiterate() const
-{
-       return params().documentClass().outputType() == LITERATE;
-}
-
-
-bool Buffer::isDocBook() const
-{
-       return params().documentClass().outputType() == DOCBOOK;
-}
-
-
 void Buffer::makeDocBookFile(FileName const & fname,
                              OutputParams const & runparams,
                              bool const body_only) const
@@ -1895,21 +1877,6 @@ void Buffer::markDepClean(string const & name)
 }
 
 
-bool Buffer::isExportableFormat(string const & format) const
-{
-               typedef vector<Format const *> Formats;
-               Formats formats;
-               formats = exportableFormats(true);
-               Formats::const_iterator fit = formats.begin();
-               Formats::const_iterator end = formats.end();
-               for (; fit != end ; ++fit) {
-                       if ((*fit)->name() == format)
-                               return true;
-               }
-               return false;
-}
-
-
 bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
 {
        if (isInternal()) {
@@ -1938,7 +1905,7 @@ bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
 
                case LFUN_BUFFER_EXPORT: {
                        docstring const arg = cmd.argument();
-                       enable = arg == "custom" || isExportable(to_utf8(arg));
+                       enable = arg == "custom" || params().isExportable(to_utf8(arg));
                        if (!enable)
                                flag.message(bformat(
                                        _("Don't know how to export to format: %1$s"), arg));
@@ -1946,11 +1913,11 @@ bool Buffer::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                }
 
                case LFUN_BUFFER_CHKTEX:
-                       enable = isLatex() && !lyxrc.chktex_command.empty();
+                       enable = params().isLatex() && !lyxrc.chktex_command.empty();
                        break;
 
                case LFUN_BUILD_PROGRAM:
-                       enable = isExportable("program");
+                       enable = params().isExportable("program");
                        break;
 
                case LFUN_BRANCH_ACTIVATE: 
@@ -3084,7 +3051,7 @@ void Buffer::getSourceCode(odocstream & os, string const format,
 {
        OutputParams runparams(&params().encoding());
        runparams.nice = true;
-       runparams.flavor = getOutputFlavor(format);
+       runparams.flavor = params().getOutputFlavor(format);
        runparams.linelen = lyxrc.plaintext_linelen;
        // No side effect of file copying and image conversion
        runparams.dryrun = true;
@@ -3094,7 +3061,7 @@ void Buffer::getSourceCode(odocstream & os, string const format,
                d->texrow.reset();
                d->texrow.newline();
                d->texrow.newline();
-               if (isDocBook())
+               if (params().isDocBook())
                        writeDocBookSource(os, absFileName(), runparams, false);
                else if (runparams.flavor == OutputParams::HTML)
                        writeLyXHTMLSource(os, runparams, false);
@@ -3122,7 +3089,7 @@ void Buffer::getSourceCode(odocstream & os, string const format,
                texrow.newline();
                texrow.newline();
                // output paragraphs
-               if (isDocBook())
+               if (params().isDocBook())
                        docbookParagraphs(text(), *this, os, runparams);
                else if (runparams.flavor == OutputParams::HTML) {
                        XHTMLStream xs(os);
@@ -3367,74 +3334,6 @@ bool Buffer::autoSave() const
 }
 
 
-string Buffer::bufferFormat() const
-{
-       string format = params().documentClass().outputFormat();
-       if (format == "latex") {
-               if (params().useNonTeXFonts)
-                       return "xetex";
-               if (params().encoding().package() == Encoding::japanese)
-                       return "platex";
-       }
-       return format;
-}
-
-
-string Buffer::getDefaultOutputFormat() const
-{
-       if (!params().default_output_format.empty()
-           && params().default_output_format != "default")
-               return params().default_output_format;
-       if (isDocBook()
-           || params().useNonTeXFonts
-           || params().encoding().package() == Encoding::japanese) {
-               vector<Format const *> const formats = exportableFormats(true);
-               if (formats.empty())
-                       return string();
-               // return the first we find
-               return formats.front()->name();
-       }
-       return lyxrc.default_view_format;
-}
-
-
-OutputParams::FLAVOR Buffer::getOutputFlavor(string const format) const
-{
-       string const dformat = (format.empty() || format == "default") ?
-               getDefaultOutputFormat() : format;
-       DefaultFlavorCache::const_iterator it =
-               default_flavors_.find(dformat);
-
-       if (it != default_flavors_.end())
-               return it->second;
-
-       OutputParams::FLAVOR result = OutputParams::LATEX;
-       
-       if (dformat == "xhtml")
-               result = OutputParams::HTML;
-       else {
-               // Try to determine flavor of default output format
-               vector<string> backs = backends();
-               if (find(backs.begin(), backs.end(), dformat) == backs.end()) {
-                       // Get shortest path to format
-                       Graph::EdgePath path;
-                       for (vector<string>::const_iterator it = backs.begin();
-                           it != backs.end(); ++it) {
-                               Graph::EdgePath p = theConverters().getPath(*it, dformat);
-                               if (!p.empty() && (path.empty() || p.size() < path.size())) {
-                                       path = p;
-                               }
-                       }
-                       if (!path.empty())
-                               result = theConverters().getFlavor(path);
-               }
-       }
-       // cache this flavor
-       default_flavors_[dformat] = result;
-       return result;
-}
-
-
 namespace {
        // helper class, to guarantee this gets reset properly
        class MarkAsExporting   {
@@ -3480,7 +3379,7 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
        runparams.flavor = OutputParams::LATEX;
        runparams.linelen = lyxrc.plaintext_linelen;
        runparams.includeall = includeall;
-       vector<string> backs = backends();
+       vector<string> backs = params().backends();
        Converters converters = theConverters();
        if (find(backs.begin(), backs.end(), format) == backs.end()) {
                // Get shortest path to format
@@ -3552,7 +3451,7 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
        } else if (backend_format == "lyx")
                writeFile(FileName(filename));
        // Docbook backend
-       else if (isDocBook()) {
+       else if (params().isDocBook()) {
                runparams.nice = !put_in_tempdir;
                makeDocBookFile(FileName(filename), runparams);
        }
@@ -3583,7 +3482,7 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
        }
 
        string const error_type = (format == "program")
-               ? "Build" : bufferFormat();
+               ? "Build" : params().bufferFormat();
        ErrorList & error_list = d->errorLists[error_type];
        string const ext = formats.extension(format);
        FileName const tmp_result_file(changeExtension(filename, ext));
@@ -3622,7 +3521,7 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
                // FIXME: There is a possibility of concurrent access to texrow
                // here from the main GUI thread that should be securized.
                d->cloned_buffer_->d->texrow = d->texrow;
-               string const error_type = bufferFormat();
+               string const error_type = params().bufferFormat();
                d->cloned_buffer_->d->errorLists[error_type] = d->errorLists[error_type];
        }
 
@@ -3704,55 +3603,6 @@ bool Buffer::preview(string const & format, bool includeall) const
 }
 
 
-bool Buffer::isExportable(string const & format) const
-{
-       vector<string> backs = backends();
-       for (vector<string>::const_iterator it = backs.begin();
-            it != backs.end(); ++it)
-               if (theConverters().isReachable(*it, format))
-                       return true;
-       return false;
-}
-
-
-vector<Format const *> Buffer::exportableFormats(bool only_viewable) const
-{
-       vector<string> const backs = backends();
-       set<string> excludes;
-       if (params().useNonTeXFonts) {
-               excludes.insert("latex");
-               excludes.insert("pdflatex");
-       }
-       vector<Format const *> result =
-               theConverters().getReachable(backs[0], only_viewable, true, excludes);
-       for (vector<string>::const_iterator it = backs.begin() + 1;
-            it != backs.end(); ++it) {
-               vector<Format const *>  r =
-                       theConverters().getReachable(*it, only_viewable, false, excludes);
-               result.insert(result.end(), r.begin(), r.end());
-       }
-       return result;
-}
-
-
-vector<string> Buffer::backends() const
-{
-       vector<string> v;
-       v.push_back(bufferFormat());
-       // FIXME: Don't hardcode format names here, but use a flag
-       if (v.back() == "latex") {
-               v.push_back("pdflatex");
-               v.push_back("luatex");
-               v.push_back("xetex");
-       } else if (v.back() == "xetex")
-               v.push_back("luatex");
-       v.push_back("xhtml");
-       v.push_back("text");
-       v.push_back("lyx");
-       return v;
-}
-
-
 Buffer::ReadStatus Buffer::extractFromVC()
 {
        bool const found = LyXVC::file_not_found_hook(d->filename);
index bd462e2640703235bc0399cbe6801698888180ae..3da4d224dd4744164ce6f5218131657c6c490275 100644 (file)
@@ -409,13 +409,6 @@ public:
        /// Set buffer read-only flag
        void setReadonly(bool flag = true);
 
-       /// returns \c true if the buffer contains a LaTeX document
-       bool isLatex() const;
-       /// returns \c true if the buffer contains a DocBook document
-       bool isDocBook() const;
-       /// returns \c true if the buffer contains a Wed document
-       bool isLiterate() const;
-
        /** Validate a buffer for LaTeX.
            This validates the buffer, and returns a struct for use by
            #makeLaTeX# and others. Its main use is to figure out what
@@ -600,14 +593,6 @@ public:
 
        
 
-       /// return the format of the buffer on a string
-       std::string bufferFormat() const;
-       /// return the default output format of the current backend
-       std::string getDefaultOutputFormat() const;
-       /// return the output flavor of \p format or the default
-       OutputParams::FLAVOR getOutputFlavor(
-                 std::string const format = std::string()) const;
-
        ///
        bool doExport(std::string const & format, bool put_in_tempdir,
                bool includeall, std::string & result_file) const;
@@ -616,12 +601,6 @@ public:
                      bool includeall = false) const;
        ///
        bool preview(std::string const & format, bool includeall = false) const;
-       ///
-       bool isExportable(std::string const & format) const;
-       ///
-       std::vector<Format const *> exportableFormats(bool only_viewable) const;
-       ///
-       bool isExportableFormat(std::string const & format) const;
        /// mark the buffer as busy exporting something, or not
        void setExportStatus(bool e) const;
        ///
@@ -668,12 +647,6 @@ private:
        /// Change name of buffer. Updates "read-only" flag.
        void setFileName(support::FileName const & fname);
        ///
-       std::vector<std::string> backends() const;
-       /// A cache for the default flavors
-       typedef std::map<std::string, OutputParams::FLAVOR> DefaultFlavorCache;
-       ///
-       mutable DefaultFlavorCache default_flavors_;
-       ///
        void getLanguages(std::set<Language const *> &) const;
        /// Checks whether any of the referenced bibfiles have changed since the
        /// last time we loaded the cache. Note that this does NOT update the
index c9803e1be99ef84b3fe0e1d3ccbe08b683bdd3f5..32c228532f91e55df44f437495977b783e1165b3 100644 (file)
@@ -24,6 +24,7 @@
 #include "Bullet.h"
 #include "Color.h"
 #include "ColorSet.h"
+#include "Converter.h"
 #include "Encoding.h"
 #include "HSpace.h"
 #include "IndicesList.h"
@@ -2052,6 +2053,137 @@ bool BufferParams::addLayoutModule(string const & modName)
 }
 
 
+string BufferParams::bufferFormat() const
+{
+       string format = documentClass().outputFormat();
+       if (format == "latex") {
+               if (useNonTeXFonts)
+                       return "xetex";
+               if (encoding().package() == Encoding::japanese)
+                       return "platex";
+       }
+       return format;
+}
+
+
+bool BufferParams::isExportable(string const & format) const
+{
+       vector<string> backs = backends();
+       for (vector<string>::const_iterator it = backs.begin();
+            it != backs.end(); ++it)
+               if (theConverters().isReachable(*it, format))
+                       return true;
+       return false;
+}
+
+
+vector<Format const *> BufferParams::exportableFormats(bool only_viewable) const
+{
+       vector<string> const backs = backends();
+       set<string> excludes;
+       if (useNonTeXFonts) {
+               excludes.insert("latex");
+               excludes.insert("pdflatex");
+       }
+       vector<Format const *> result =
+               theConverters().getReachable(backs[0], only_viewable, true, excludes);
+       for (vector<string>::const_iterator it = backs.begin() + 1;
+            it != backs.end(); ++it) {
+               vector<Format const *>  r =
+                       theConverters().getReachable(*it, only_viewable, false, excludes);
+               result.insert(result.end(), r.begin(), r.end());
+       }
+       return result;
+}
+
+
+bool BufferParams::isExportableFormat(string const & format) const
+{
+               typedef vector<Format const *> Formats;
+               Formats formats;
+               formats = exportableFormats(true);
+               Formats::const_iterator fit = formats.begin();
+               Formats::const_iterator end = formats.end();
+               for (; fit != end ; ++fit) {
+                       if ((*fit)->name() == format)
+                               return true;
+               }
+               return false;
+}
+
+
+vector<string> BufferParams::backends() const
+{
+       vector<string> v;
+       v.push_back(bufferFormat());
+       // FIXME: Don't hardcode format names here, but use a flag
+       if (v.back() == "latex") {
+               v.push_back("pdflatex");
+               v.push_back("luatex");
+               v.push_back("xetex");
+       } else if (v.back() == "xetex")
+               v.push_back("luatex");
+       v.push_back("xhtml");
+       v.push_back("text");
+       v.push_back("lyx");
+       return v;
+}
+
+
+OutputParams::FLAVOR BufferParams::getOutputFlavor(string const format) const
+{
+       string const dformat = (format.empty() || format == "default") ?
+               getDefaultOutputFormat() : format;
+       DefaultFlavorCache::const_iterator it =
+               default_flavors_.find(dformat);
+
+       if (it != default_flavors_.end())
+               return it->second;
+
+       OutputParams::FLAVOR result = OutputParams::LATEX;
+
+       if (dformat == "xhtml")
+               result = OutputParams::HTML;
+       else {
+               // Try to determine flavor of default output format
+               vector<string> backs = backends();
+               if (find(backs.begin(), backs.end(), dformat) == backs.end()) {
+                       // Get shortest path to format
+                       Graph::EdgePath path;
+                       for (vector<string>::const_iterator it = backs.begin();
+                           it != backs.end(); ++it) {
+                               Graph::EdgePath p = theConverters().getPath(*it, dformat);
+                               if (!p.empty() && (path.empty() || p.size() < path.size())) {
+                                       path = p;
+                               }
+                       }
+                       if (!path.empty())
+                               result = theConverters().getFlavor(path);
+               }
+       }
+       // cache this flavor
+       default_flavors_[dformat] = result;
+       return result;
+}
+
+
+string BufferParams::getDefaultOutputFormat() const
+{
+       if (!default_output_format.empty()
+           && default_output_format != "default")
+               return default_output_format;
+       if (isDocBook()
+           || useNonTeXFonts
+           || encoding().package() == Encoding::japanese) {
+               vector<Format const *> const formats = exportableFormats(true);
+               if (formats.empty())
+                       return string();
+               // return the first we find
+               return formats.front()->name();
+       }
+       return lyxrc.default_view_format;
+}
+
 Font const BufferParams::getFont() const
 {
        FontInfo f = documentClass().defaultfont();
@@ -2065,6 +2197,24 @@ Font const BufferParams::getFont() const
 }
 
 
+bool BufferParams::isLatex() const
+{
+       return documentClass().outputType() == LATEX;
+}
+
+
+bool BufferParams::isLiterate() const
+{
+       return documentClass().outputType() == LITERATE;
+}
+
+
+bool BufferParams::isDocBook() const
+{
+       return documentClass().outputType() == DOCBOOK;
+}
+
+
 void BufferParams::readPreamble(Lexer & lex)
 {
        if (lex.getString() != "\\begin_preamble")
index 96747d51f32985343da1b41e0a3d97c15aff9228..2c4828e1c48ecae4a03a6813da4ce6f1579940cf 100644 (file)
@@ -16,7 +16,9 @@
 #define BUFFERPARAMS_H
 
 #include "Citation.h"
+#include "Format.h"
 #include "LayoutModuleList.h"
+#include "OutputParams.h"
 #include "paper.h"
 
 #include "insets/InsetQuotes.h"
@@ -24,6 +26,7 @@
 #include "support/copied_ptr.h"
 
 #include <map>
+#include <vector>
 
 namespace lyx {
 
@@ -153,6 +156,29 @@ public:
        /// Clear the removed module list
        void clearRemovedModules() { removed_modules_.clear(); }
 
+       /// returns \c true if the buffer contains a LaTeX document
+       bool isLatex() const;
+       /// returns \c true if the buffer contains a DocBook document
+       bool isDocBook() const;
+       /// returns \c true if the buffer contains a Wed document
+       bool isLiterate() const;
+
+       /// return the format of the buffer on a string
+       std::string bufferFormat() const;
+       /// return the default output format of the current backend
+       std::string getDefaultOutputFormat() const;
+       /// return the output flavor of \p format or the default
+       OutputParams::FLAVOR getOutputFlavor(
+                 std::string const format = std::string()) const;
+       ///
+       bool isExportable(std::string const & format) const;
+       ///
+       std::vector<Format const *> exportableFormats(bool only_viewable) const;
+       ///
+       bool isExportableFormat(std::string const & format) const;
+       ///
+       std::vector<std::string> backends() const;
+
        /// List of included children (for includeonly)
        std::list<std::string> const & getIncludedChildren() const 
                        { return included_children_; }
@@ -437,6 +463,10 @@ private:
        void readRemovedModules(Lexer &);
        ///
        void readIncludeonly(Lexer &);
+       /// A cache for the default flavors
+       typedef std::map<std::string, OutputParams::FLAVOR> DefaultFlavorCache;
+       ///
+       mutable DefaultFlavorCache default_flavors_;
        /// for use with natbib
        CiteEngine cite_engine_;
        ///
index 0f0f4b44eb77090b3085723e345fb08861f7501a..087b0b6af30494044df806eb168b5106069215bf 100644 (file)
@@ -337,7 +337,7 @@ bool Converters::convert(Buffer const * buffer,
        runparams.flavor = getFlavor(edgepath);
 
        if (buffer) {
-               runparams.use_japanese = buffer->bufferFormat() == "platex";
+               runparams.use_japanese = buffer->params().bufferFormat() == "platex";
                runparams.use_indices = buffer->params().use_indices;
                runparams.bibtex_command = (buffer->params().bibtex_command == "default") ?
                        string() : buffer->params().bibtex_command;
index 6280ea1b6840c6b7acdcf41c740fc964fcce6be5..5007ac0ba7846e8db65019b571caf616063a26de 100644 (file)
@@ -16,6 +16,7 @@
 #include "qt_helpers.h"
 
 #include "Buffer.h"
+#include "BufferParams.h"
 #include "BufferView.h"
 #include "Cursor.h"
 #include "FuncRequest.h"
@@ -99,9 +100,9 @@ QString Dialog::bufferFilePath() const
 
 KernelDocType Dialog::docType() const
 {
-       if (buffer().isLatex())
+       if (buffer().params().isLatex())
                return LATEX;
-       if (buffer().isLiterate())
+       if (buffer().params().isLiterate())
                return LITERATE;
 
        return DOCBOOK;
index 05414d403978f199f5903a3d519290876afdb7b5..26961f26a23ced337775879b1c695bf3a95f9d1b 100644 (file)
@@ -2105,29 +2105,26 @@ void GuiDocument::updateDefaultFormat()
        if (!bufferview())
                return;
        // make a copy in order to consider unapplied changes
-       Buffer * tmpbuf = buffer().clone();
-       tmpbuf->params().useNonTeXFonts =
-               fontModule->osFontsCB->isChecked();
-       int idx = latexModule->classCO->currentIndex();
+       BufferParams param_copy = buffer().params();
+       param_copy.useNonTeXFonts = fontModule->osFontsCB->isChecked();
+       int const idx = latexModule->classCO->currentIndex();
        if (idx >= 0) {
                string const classname = classes_model_.getIDString(idx);
-               tmpbuf->params().setBaseClass(classname);
-               tmpbuf->params().makeDocumentClass();
+               param_copy.setBaseClass(classname);
+               param_copy.makeDocumentClass();
        }
        outputModule->defaultFormatCO->blockSignals(true);
        outputModule->defaultFormatCO->clear();
        outputModule->defaultFormatCO->addItem(qt_("Default"),
                                QVariant(QString("default")));
        typedef vector<Format const *> Formats;
-       Formats formats = tmpbuf->exportableFormats(true);
+       Formats formats = param_copy.exportableFormats(true);
        Formats::const_iterator cit = formats.begin();
        Formats::const_iterator end = formats.end();
        for (; cit != end; ++cit)
                outputModule->defaultFormatCO->addItem(qt_((*cit)->prettyname()),
                                QVariant(toqstr((*cit)->name())));
        outputModule->defaultFormatCO->blockSignals(false);
-       // delete the copy
-       delete tmpbuf;
 }
 
 
index 18694b28e28cb4f304f3d015e2716093ff678b98..408b5a4f124534cfce20e894b7cf47636f23f980 100644 (file)
@@ -15,6 +15,7 @@
 #include "qt_helpers.h"
 
 #include "Buffer.h"
+#include "BufferParams.h"
 #include "Format.h"
 #include "FuncRequest.h"
 
@@ -67,7 +68,7 @@ void GuiSendTo::changed_adaptor()
 
 void GuiSendTo::updateContents()
 {
-       all_formats_ = buffer().exportableFormats(false);
+       all_formats_ = buffer().params().exportableFormats(false);
 
        // Save the current selection if any
        Format const * current_format = 0;
index c096747e5579147421ec14f58a54aa61b0e65c5d..683982a2f78f7c72963321fc472f9a61a168c977 100644 (file)
@@ -1616,8 +1616,8 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                }
                string format = to_utf8(cmd.argument());
                if (cmd.argument().empty())
-                       format = doc_buffer->getDefaultOutputFormat();
-               enable = doc_buffer->isExportableFormat(format);
+                       format = doc_buffer->params().getDefaultOutputFormat();
+               enable = doc_buffer->params().isExportableFormat(format);
                break;
        }
 
@@ -1721,7 +1721,7 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
                                || name == "progress"
                                || name == "compare";
                else if (name == "print")
-                       enable = doc_buffer->isExportable("dvi")
+                       enable = doc_buffer->params().isExportable("dvi")
                                && lyxrc.print_command != "none";
                else if (name == "character" || name == "symbols") {
                        if (!buf || buf->isReadonly())
@@ -3017,7 +3017,7 @@ bool GuiView::GuiViewPrivate::asyncBufferProcessing(
 
        string format = argument;
        if (format.empty())
-               format = used_buffer->getDefaultOutputFormat();
+               format = used_buffer->params().getDefaultOutputFormat();
 
 #if EXPORT_in_THREAD && (QT_VERSION >= 0x040400)
        if (!msg.empty()) {
@@ -3031,7 +3031,7 @@ bool GuiView::GuiViewPrivate::asyncBufferProcessing(
                                used_buffer->clone(),
                                format);
        setPreviewFuture(f);
-       last_export_format = used_buffer->bufferFormat();
+       last_export_format = used_buffer->params().bufferFormat();
        (void) syncFunc;
        (void) previewFunc;
        // We are asynchronous, so we don't know here anything about the success
index e538090c87b214c66131826056289cff4b8f50c6..345bfedd44968b3644fa46b477b8304d49db6cc5 100644 (file)
@@ -17,8 +17,9 @@
 #include "LaTeXHighlighter.h"
 #include "qt_helpers.h"
 
-#include "BufferView.h"
 #include "Buffer.h"
+#include "BufferParams.h"
+#include "BufferView.h"
 #include "Cursor.h"
 #include "Format.h"
 #include "Paragraph.h"
@@ -183,7 +184,7 @@ void ViewSourceWidget::updateDefaultFormat()
        outputFormatCO->addItem(qt_("Default"),
                                QVariant(QString("default")));
        typedef vector<Format const *> Formats;
-       Formats formats = bv_->buffer().exportableFormats(true);
+       Formats formats = bv_->buffer().params().exportableFormats(true);
        Formats::const_iterator cit = formats.begin();
        Formats::const_iterator end = formats.end();
        for (; cit != end; ++cit)
index e150b08758af7676f79bc8a864511cffabbd5a4f..c59c68999c1254af2ffdf3162ad26636586fa420 100644 (file)
@@ -1007,15 +1007,15 @@ void MenuDefinition::expandFormats(MenuItem::Kind kind, Buffer const * buf)
                action = LFUN_BUFFER_IMPORT;
                break;
        case MenuItem::ViewFormats:
-               formats = buf->exportableFormats(true);
+               formats = buf->params().exportableFormats(true);
                action = LFUN_BUFFER_VIEW;
                break;
        case MenuItem::UpdateFormats:
-               formats = buf->exportableFormats(true);
+               formats = buf->params().exportableFormats(true);
                action = LFUN_BUFFER_UPDATE;
                break;
        default:
-               formats = buf->exportableFormats(false);
+               formats = buf->params().exportableFormats(false);
                action = LFUN_BUFFER_EXPORT;
        }
        sort(formats.begin(), formats.end(), &compareFormat);
@@ -1058,7 +1058,7 @@ void MenuDefinition::expandFormats(MenuItem::Kind kind, Buffer const * buf)
                        break;
                case MenuItem::ViewFormats:
                case MenuItem::UpdateFormats:
-                       if ((*fit)->name() == buf->getDefaultOutputFormat()) {
+                       if ((*fit)->name() == buf->params().getDefaultOutputFormat()) {
                                docstring lbl = (kind == MenuItem::ViewFormats ?
                                        bformat(_("View [%1$s]|V"), qstring_to_ucs4(label))
                                        : bformat(_("Update [%1$s]|U"), qstring_to_ucs4(label)));
index 17dff650207c3c09f6114ce8f9fc2f06e53234dc..c7c55d2aabfbdadc37cccb73e154b6be513bb536 100644 (file)
@@ -388,7 +388,7 @@ namespace graphics {
 PreviewLoader::Impl::Impl(PreviewLoader & p, Buffer const & b)
        : parent_(p), buffer_(b)
 {
-       if (b.bufferFormat() == "lilypond-book")
+       if (b.params().bufferFormat() == "lilypond-book")
                pconverter_ = setConverter("lyxpreview-lytex");
        else if (b.params().encoding().package() == Encoding::japanese)
                pconverter_ = setConverter("lyxpreview-platex");
index 5bc417ad2097a8537378c3e81f4ebbb809abb142..628cb00be31b421837ef16d98d0b2dcf6a2f4ca1 100644 (file)
@@ -600,7 +600,7 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
                tmp->markDepClean(masterBuffer->temppath());
 
                // Don't assume the child's format is latex
-               string const inc_format = tmp->bufferFormat();
+               string const inc_format = tmp->params().bufferFormat();
                FileName const tmpwritefile(changeExtension(writefile.absFileName(),
                        formats.extension(inc_format)));
 
index e946206ddda53c2ffd95c37618a6beb6e97884cd..7b6cf6d98109d455bb50d92c4ecf7b3065f7e306 100644 (file)
@@ -263,7 +263,7 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType)
        }
        label += ref;
        
-       if (!buffer().isLatex() && !getParam("name").empty()) {
+       if (!buffer().params().isLatex() && !getParam("name").empty()) {
                label += "||";
                label += getParam("name");
        }
index 22e3b71f8f33aee94ae472eef9b32d4521d2f6c2..a15ec587f9a3dc3380b997cb527d5ff82b2a16d7 100644 (file)
@@ -991,7 +991,7 @@ docstring latexifyFromCursor(DocIterator const & cur, int len)
        LYXERR(Debug::FIND, "  with cur.lastpost=" << cur.lastpos() << ", cur.lastrow="
                << cur.lastrow() << ", cur.lastcol=" << cur.lastcol());
        Buffer const & buf = *cur.buffer();
-       LASSERT(buf.isLatex(), /* */);
+       LASSERT(buf.params().isLatex(), /* */);
 
        TexRow texrow;
        odocstringstream ods;