From d7ed0882ead9bda90fd009d03e567d19ebd62455 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Fri, 13 May 2011 22:39:21 +0000 Subject: [PATCH] Backport r38743-4. This is cleanup, prior to serious work on Buffer::clone(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@38745 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/Buffer.cpp | 172 ++-------------------------- src/Buffer.h | 27 ----- src/BufferParams.cpp | 150 ++++++++++++++++++++++++ src/BufferParams.h | 30 +++++ src/Converter.cpp | 2 +- src/frontends/qt4/Dialog.cpp | 5 +- src/frontends/qt4/GuiDocument.cpp | 15 +-- src/frontends/qt4/GuiSendto.cpp | 3 +- src/frontends/qt4/GuiView.cpp | 10 +- src/frontends/qt4/GuiViewSource.cpp | 5 +- src/frontends/qt4/Menus.cpp | 8 +- src/graphics/PreviewLoader.cpp | 2 +- src/insets/InsetInclude.cpp | 2 +- src/insets/InsetRef.cpp | 2 +- src/lyxfind.cpp | 2 +- 15 files changed, 219 insertions(+), 216 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 45cd9dbdc6..f51084e8ef 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -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 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(¶ms().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 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 backs = backends(); - if (find(backs.begin(), backs.end(), dformat) == backs.end()) { - // Get shortest path to format - Graph::EdgePath path; - for (vector::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 backs = backends(); + vector 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 backs = backends(); - for (vector::const_iterator it = backs.begin(); - it != backs.end(); ++it) - if (theConverters().isReachable(*it, format)) - return true; - return false; -} - - -vector Buffer::exportableFormats(bool only_viewable) const -{ - vector const backs = backends(); - set excludes; - if (params().useNonTeXFonts) { - excludes.insert("latex"); - excludes.insert("pdflatex"); - } - vector result = - theConverters().getReachable(backs[0], only_viewable, true, excludes); - for (vector::const_iterator it = backs.begin() + 1; - it != backs.end(); ++it) { - vector r = - theConverters().getReachable(*it, only_viewable, false, excludes); - result.insert(result.end(), r.begin(), r.end()); - } - return result; -} - - -vector Buffer::backends() const -{ - vector 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); diff --git a/src/Buffer.h b/src/Buffer.h index bd462e2640..3da4d224dd 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -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 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 backends() const; - /// A cache for the default flavors - typedef std::map DefaultFlavorCache; - /// - mutable DefaultFlavorCache default_flavors_; - /// void getLanguages(std::set &) 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 diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index c9803e1be9..32c228532f 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -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 backs = backends(); + for (vector::const_iterator it = backs.begin(); + it != backs.end(); ++it) + if (theConverters().isReachable(*it, format)) + return true; + return false; +} + + +vector BufferParams::exportableFormats(bool only_viewable) const +{ + vector const backs = backends(); + set excludes; + if (useNonTeXFonts) { + excludes.insert("latex"); + excludes.insert("pdflatex"); + } + vector result = + theConverters().getReachable(backs[0], only_viewable, true, excludes); + for (vector::const_iterator it = backs.begin() + 1; + it != backs.end(); ++it) { + vector 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 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 BufferParams::backends() const +{ + vector 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 backs = backends(); + if (find(backs.begin(), backs.end(), dformat) == backs.end()) { + // Get shortest path to format + Graph::EdgePath path; + for (vector::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 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") diff --git a/src/BufferParams.h b/src/BufferParams.h index 96747d51f3..2c4828e1c4 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -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 +#include 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 exportableFormats(bool only_viewable) const; + /// + bool isExportableFormat(std::string const & format) const; + /// + std::vector backends() const; + /// List of included children (for includeonly) std::list 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 DefaultFlavorCache; + /// + mutable DefaultFlavorCache default_flavors_; /// for use with natbib CiteEngine cite_engine_; /// diff --git a/src/Converter.cpp b/src/Converter.cpp index 0f0f4b44eb..087b0b6af3 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -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; diff --git a/src/frontends/qt4/Dialog.cpp b/src/frontends/qt4/Dialog.cpp index 6280ea1b68..5007ac0ba7 100644 --- a/src/frontends/qt4/Dialog.cpp +++ b/src/frontends/qt4/Dialog.cpp @@ -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; diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 05414d4039..26961f26a2 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -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 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; } diff --git a/src/frontends/qt4/GuiSendto.cpp b/src/frontends/qt4/GuiSendto.cpp index 18694b28e2..408b5a4f12 100644 --- a/src/frontends/qt4/GuiSendto.cpp +++ b/src/frontends/qt4/GuiSendto.cpp @@ -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; diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index c096747e55..683982a2f7 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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 diff --git a/src/frontends/qt4/GuiViewSource.cpp b/src/frontends/qt4/GuiViewSource.cpp index e538090c87..345bfedd44 100644 --- a/src/frontends/qt4/GuiViewSource.cpp +++ b/src/frontends/qt4/GuiViewSource.cpp @@ -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 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) diff --git a/src/frontends/qt4/Menus.cpp b/src/frontends/qt4/Menus.cpp index e150b08758..c59c68999c 100644 --- a/src/frontends/qt4/Menus.cpp +++ b/src/frontends/qt4/Menus.cpp @@ -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))); diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 17dff65020..c7c55d2aab 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -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"); diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 5bc417ad20..628cb00be3 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -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))); diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp index e946206ddd..7b6cf6d981 100644 --- a/src/insets/InsetRef.cpp +++ b/src/insets/InsetRef.cpp @@ -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"); } diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 22e3b71f8f..a15ec587f9 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -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; -- 2.39.5