And here are next 4 patches. Yuriy
From e89abcf0654343ec6090ace2bfe243809b64cabc Mon Sep 17 00:00:00 2001 From: Yuriy Skalko <yuriy.ska...@gmail.com> Date: Mon, 30 Nov 2020 18:06:12 +0200 Subject: [PATCH 1/4] Remove useless breaks
--- src/insets/InsetNewpage.cpp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/src/insets/InsetNewpage.cpp b/src/insets/InsetNewpage.cpp index f4eba12cf8..da94452632 100644 --- a/src/insets/InsetNewpage.cpp +++ b/src/insets/InsetNewpage.cpp @@ -237,22 +237,16 @@ docstring InsetNewpage::insetLabel() const switch (params_.kind) { case InsetNewpageParams::NEWPAGE: return _("New Page"); - break; case InsetNewpageParams::PAGEBREAK: return _("Page Break"); - break; case InsetNewpageParams::CLEARPAGE: return _("Clear Page"); - break; case InsetNewpageParams::CLEARDOUBLEPAGE: return _("Clear Double Page"); - break; case InsetNewpageParams::NOPAGEBREAK: return _("No Page Break"); - break; default: return _("New Page"); - break; } } @@ -263,12 +257,10 @@ ColorCode InsetNewpage::ColorName() const case InsetNewpageParams::PAGEBREAK: case InsetNewpageParams::NOPAGEBREAK: return Color_pagebreak; - break; case InsetNewpageParams::NEWPAGE: case InsetNewpageParams::CLEARPAGE: case InsetNewpageParams::CLEARDOUBLEPAGE: return Color_newpage; - break; } // not really useful, but to avoids gcc complaints return Color_newpage; -- 2.28.0.windows.1
From a5797c5fbac5022ef76b817b8b2daee3e6e023ff Mon Sep 17 00:00:00 2001 From: Yuriy Skalko <yuriy.ska...@gmail.com> Date: Mon, 30 Nov 2020 22:34:16 +0200 Subject: [PATCH 2/4] Refactor InsetQuotes.h enums --- src/BufferParams.cpp | 37 ++++--- src/BufferParams.h | 12 +- src/Format.cpp | 1 + src/Text3.cpp | 4 +- src/frontends/qt/GuiDocument.cpp | 17 +-- src/frontends/qt/GuiDocument.h | 2 + src/frontends/qt/Menus.cpp | 4 +- src/insets/InsetQuotes.cpp | 184 +++++++++++++++---------------- src/insets/InsetQuotes.h | 116 +++++++++---------- src/output_plaintext.cpp | 2 + 10 files changed, 197 insertions(+), 182 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index bd78dae698..798c773557 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -45,6 +45,7 @@ #include "frontends/alert.h" #include "insets/InsetListingsParams.h" +#include "insets/InsetQuotes.h" #include "support/convert.h" #include "support/debug.h" @@ -135,26 +136,26 @@ ParSepTranslator const & parseptranslator() // Quotes style -typedef Translator<string, InsetQuotesParams::QuoteStyle> QuotesStyleTranslator; +typedef Translator<string, QuoteStyle> QuotesStyleTranslator; QuotesStyleTranslator const init_quotesstyletranslator() { QuotesStyleTranslator translator - (string_quotes_style[0], InsetQuotesParams::EnglishQuotes); - translator.addPair(string_quotes_style[1], InsetQuotesParams::SwedishQuotes); - translator.addPair(string_quotes_style[2], InsetQuotesParams::GermanQuotes); - translator.addPair(string_quotes_style[3], InsetQuotesParams::PolishQuotes); - translator.addPair(string_quotes_style[4], InsetQuotesParams::SwissQuotes); - translator.addPair(string_quotes_style[5], InsetQuotesParams::DanishQuotes); - translator.addPair(string_quotes_style[6], InsetQuotesParams::PlainQuotes); - translator.addPair(string_quotes_style[7], InsetQuotesParams::BritishQuotes); - translator.addPair(string_quotes_style[8], InsetQuotesParams::SwedishGQuotes); - translator.addPair(string_quotes_style[9], InsetQuotesParams::FrenchQuotes); - translator.addPair(string_quotes_style[10], InsetQuotesParams::FrenchINQuotes); - translator.addPair(string_quotes_style[11], InsetQuotesParams::RussianQuotes); - translator.addPair(string_quotes_style[12], InsetQuotesParams::CJKQuotes); - translator.addPair(string_quotes_style[13], InsetQuotesParams::CJKAngleQuotes); + (string_quotes_style[0], QuoteStyle::EnglishQuotes); + translator.addPair(string_quotes_style[1], QuoteStyle::SwedishQuotes); + translator.addPair(string_quotes_style[2], QuoteStyle::GermanQuotes); + translator.addPair(string_quotes_style[3], QuoteStyle::PolishQuotes); + translator.addPair(string_quotes_style[4], QuoteStyle::SwissQuotes); + translator.addPair(string_quotes_style[5], QuoteStyle::DanishQuotes); + translator.addPair(string_quotes_style[6], QuoteStyle::PlainQuotes); + translator.addPair(string_quotes_style[7], QuoteStyle::BritishQuotes); + translator.addPair(string_quotes_style[8], QuoteStyle::SwedishGQuotes); + translator.addPair(string_quotes_style[9], QuoteStyle::FrenchQuotes); + translator.addPair(string_quotes_style[10], QuoteStyle::FrenchINQuotes); + translator.addPair(string_quotes_style[11], QuoteStyle::RussianQuotes); + translator.addPair(string_quotes_style[12], QuoteStyle::CJKQuotes); + translator.addPair(string_quotes_style[13], QuoteStyle::CJKAngleQuotes); return translator; } @@ -393,7 +394,7 @@ BufferParams::BufferParams() paragraph_separation = ParagraphIndentSeparation; is_math_indent = false; math_numbering_side = DEFAULT; - quotes_style = InsetQuotesParams::EnglishQuotes; + quotes_style = QuoteStyle::EnglishQuotes; dynamic_quotes = false; fontsize = "default"; @@ -1452,7 +1453,7 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const os << "default"; } os << "\n\\quotes_style " - << string_quotes_style[quotes_style] + << string_quotes_style[static_cast<int>(quotes_style)] << "\n\\dynamic_quotes " << dynamic_quotes << "\n\\papercolumns " << columns << "\n\\papersides " << sides @@ -2789,7 +2790,7 @@ Font const BufferParams::getFont() const } -InsetQuotesParams::QuoteStyle BufferParams::getQuoteStyle(string const & qs) const +QuoteStyle BufferParams::getQuoteStyle(string const & qs) const { return quotesstyletranslator().find(qs); } diff --git a/src/BufferParams.h b/src/BufferParams.h index 21bfc10b2e..031524fe1a 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -16,13 +16,13 @@ #define BUFFERPARAMS_H #include "Citation.h" +#include "ColorCode.h" #include "DocumentClassPtr.h" #include "LayoutModuleList.h" #include "paper.h" -#include "insets/InsetQuotes.h" - #include "support/copied_ptr.h" +#include "support/types.h" #include <map> #include <vector> @@ -35,21 +35,25 @@ class Author; class AuthorList; class BranchList; class Bullet; +class Buffer; class DocumentClass; class Encoding; class Font; class Format; class IndicesList; class Language; +class LaTeXFeatures; class LayoutFile; class LayoutFileIndex; class Length; class Lexer; +class otexstream; class PDFOptions; class Spacing; class VSpace; enum class FLAVOR : int; +enum class QuoteStyle : int; /** Buffer parameters. * This class contains all the parameters for this buffer's use. Some @@ -125,7 +129,7 @@ public: */ ParagraphSeparation paragraph_separation; /// - InsetQuotesParams::QuoteStyle quotes_style; + QuoteStyle quotes_style; /// bool dynamic_quotes; /// @@ -224,7 +228,7 @@ public: Font const getFont() const; /// translate quote style string to enum value - InsetQuotesParams::QuoteStyle getQuoteStyle(std::string const & qs) const; + QuoteStyle getQuoteStyle(std::string const & qs) const; /* these are for the PaperLayout */ /// the papersize diff --git a/src/Format.cpp b/src/Format.cpp index 4af5790058..9c27c43651 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -14,6 +14,7 @@ #include "Buffer.h" #include "BufferParams.h" #include "LyXRC.h" +#include "OutputParams.h" #include "ServerSocket.h" #include "frontends/alert.h" //to be removed? diff --git a/src/Text3.cpp b/src/Text3.cpp index aa34971e8c..37eae57af8 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1781,8 +1781,8 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) } } } - InsetQuotesParams::QuoteLevel const quote_level = inner - ? InsetQuotesParams::SecondaryQuotes : InsetQuotesParams::PrimaryQuotes; + QuoteLevel const quote_level = inner + ? QuoteLevel::SecondaryQuotes : QuoteLevel::PrimaryQuotes; cur.insert(new InsetQuotes(cur.buffer(), c, quote_level, cmd.getArg(1), cmd.getArg(2))); cur.buffer()->updateBuffer(); cur.posForward(); diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp index 75d960f058..281bab3870 100644 --- a/src/frontends/qt/GuiDocument.cpp +++ b/src/frontends/qt/GuiDocument.cpp @@ -55,6 +55,7 @@ #include "VSpace.h" #include "insets/InsetListingsParams.h" +#include "insets/InsetQuotes.h" #include "support/debug.h" #include "support/docstream.h" @@ -2259,25 +2260,25 @@ void GuiDocument::updateQuoteStyles(bool const set) fromqstr(langModule->languageCO->itemData( langModule->languageCO->currentIndex()).toString())); - InsetQuotesParams::QuoteStyle def = bp_.getQuoteStyle(lang->quoteStyle()); + QuoteStyle def = bp_.getQuoteStyle(lang->quoteStyle()); langModule->quoteStyleCO->clear(); bool has_default = false; for (int i = 0; i < quoteparams.stylescount(); ++i) { - InsetQuotesParams::QuoteStyle qs = InsetQuotesParams::QuoteStyle(i); - if (qs == InsetQuotesParams::DynamicQuotes) + QuoteStyle qs = QuoteStyle(i); + if (qs == QuoteStyle::DynamicQuotes) continue; bool const langdef = (qs == def); if (langdef) { // add the default style on top langModule->quoteStyleCO->insertItem(0, - toqstr(quoteparams.getGuiLabel(qs, langdef)), qs); + toqstr(quoteparams.getGuiLabel(qs, langdef)), static_cast<int>(qs)); has_default = true; } else langModule->quoteStyleCO->addItem( - toqstr(quoteparams.getGuiLabel(qs, langdef)), qs); + toqstr(quoteparams.getGuiLabel(qs, langdef)), static_cast<int>(qs)); } if (set && has_default) // (re)set to the default style @@ -3437,8 +3438,8 @@ void GuiDocument::applyView() // this should never happen bp_.inputenc = "utf8"; } - bp_.quotes_style = (InsetQuotesParams::QuoteStyle) langModule->quoteStyleCO->itemData( - langModule->quoteStyleCO->currentIndex()).toInt(); + bp_.quotes_style = QuoteStyle(langModule->quoteStyleCO->itemData( + langModule->quoteStyleCO->currentIndex()).toInt()); bp_.dynamic_quotes = langModule->dynamicQuotesCB->isChecked(); QString const langname = langModule->languageCO->itemData( @@ -3958,7 +3959,7 @@ void GuiDocument::paramsToDialog() updateQuoteStyles(); langModule->quoteStyleCO->setCurrentIndex( - langModule->quoteStyleCO->findData(bp_.quotes_style)); + langModule->quoteStyleCO->findData(static_cast<int>(bp_.quotes_style))); langModule->dynamicQuotesCB->setChecked(bp_.dynamic_quotes); // LaTeX input encoding: set after the fonts (see below) diff --git a/src/frontends/qt/GuiDocument.h b/src/frontends/qt/GuiDocument.h index 52da41300e..76bdd65488 100644 --- a/src/frontends/qt/GuiDocument.h +++ b/src/frontends/qt/GuiDocument.h @@ -37,6 +37,8 @@ #include "ui_PreambleUi.h" #include "ui_TextLayoutUi.h" +#include "support/unique_ptr.h" + #include <QStandardItemModel> namespace lyx { diff --git a/src/frontends/qt/Menus.cpp b/src/frontends/qt/Menus.cpp index e8734b72c7..8437ace210 100644 --- a/src/frontends/qt/Menus.cpp +++ b/src/frontends/qt/Menus.cpp @@ -1820,11 +1820,11 @@ void MenuDefinition::expandQuotes(BufferView const * bv) BufferParams const & bp = bv->buffer().masterBuffer()->params(); // The global setting - InsetQuotesParams::QuoteStyle globalqs = bp.quotes_style; + QuoteStyle globalqs = bp.quotes_style; char const globalqsc = quoteparams.getStyleChar(globalqs); // The current language's default - InsetQuotesParams::QuoteStyle langdefqs = + QuoteStyle langdefqs = bp.getQuoteStyle(bv->cursor().current_font.language()->quoteStyle()); char const langqs = quoteparams.getStyleChar(langdefqs); diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index 5315e39e11..332de763b8 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -94,11 +94,11 @@ int InsetQuotesParams::stylescount() const char InsetQuotesParams::getStyleChar(QuoteStyle const & style) const { - return style_char[style]; + return style_char[static_cast<int>(style)]; } -InsetQuotesParams::QuoteStyle InsetQuotesParams::getQuoteStyle(string const & s, +QuoteStyle InsetQuotesParams::getQuoteStyle(string const & s, bool const allow_wildcards, QuoteStyle fb) const { QuoteStyle res = fb; @@ -122,7 +122,7 @@ InsetQuotesParams::QuoteStyle InsetQuotesParams::getQuoteStyle(string const & s, if (i >= stylescount()) { LYXERR0("ERROR (InsetQuotes::InsetQuotes):" " bad style specification."); - res = EnglishQuotes; + res = QuoteStyle::EnglishQuotes; } } @@ -130,7 +130,7 @@ InsetQuotesParams::QuoteStyle InsetQuotesParams::getQuoteStyle(string const & s, } -InsetQuotesParams::QuoteSide InsetQuotesParams::getQuoteSide(string const & s, +QuoteSide InsetQuotesParams::getQuoteSide(string const & s, bool const allow_wildcards, QuoteSide fb) const { QuoteSide res = fb; @@ -147,14 +147,14 @@ InsetQuotesParams::QuoteSide InsetQuotesParams::getQuoteSide(string const & s, int i; for (i = 0; i < 2; ++i) { if (str[1] == side_char[i]) { - res = InsetQuotesParams::QuoteSide(i); + res = QuoteSide(i); break; } } if (i >= 2) { LYXERR0("ERROR (InsetQuotes::InsetQuotes):" " bad side specification."); - res = OpeningQuote; + res = QuoteSide::OpeningQuote; } } @@ -162,7 +162,7 @@ InsetQuotesParams::QuoteSide InsetQuotesParams::getQuoteSide(string const & s, } -InsetQuotesParams::QuoteLevel InsetQuotesParams::getQuoteLevel(string const & s, +QuoteLevel InsetQuotesParams::getQuoteLevel(string const & s, bool const allow_wildcards, QuoteLevel fb) const { QuoteLevel res = fb; @@ -179,14 +179,14 @@ InsetQuotesParams::QuoteLevel InsetQuotesParams::getQuoteLevel(string const & s, int i; for (i = 0; i < 2; ++i) { if (str[2] == level_char[i]) { - res = InsetQuotesParams::QuoteLevel(i); + res = QuoteLevel(i); break; } } if (i >= 2) { LYXERR0("ERROR (InsetQuotes::InsetQuotes):" " bad level specification."); - res = InsetQuotesParams::PrimaryQuotes; + res = QuoteLevel::PrimaryQuotes; } } @@ -207,105 +207,105 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c char_type right_secondary; switch (style) { - case EnglishQuotes: { + case QuoteStyle::EnglishQuotes: { left_primary = 0x201c; // `` right_primary = 0x201d; // '' left_secondary = 0x2018; // ` right_secondary = 0x2019; // ' break; } - case SwedishQuotes: { + case QuoteStyle::SwedishQuotes: { left_primary = 0x201d; // '' right_primary = 0x201d; // '' left_secondary = 0x2019; // ' right_secondary = 0x2019; // ' break; } - case GermanQuotes: { + case QuoteStyle::GermanQuotes: { left_primary = 0x201e; // ,, right_primary = 0x201c; // `` left_secondary = 0x201a; // , right_secondary = 0x2018; // ` break; } - case PolishQuotes: { + case QuoteStyle::PolishQuotes: { left_primary = 0x201e; // ,, right_primary = 0x201d; // '' left_secondary = 0x201a; // , right_secondary = 0x2019; // ' break; } - case SwissQuotes: { + case QuoteStyle::SwissQuotes: { left_primary = 0x00ab; // << right_primary = 0x00bb; // >> left_secondary = 0x2039; // < right_secondary = 0x203a; // > break; } - case DanishQuotes: { + case QuoteStyle::DanishQuotes: { left_primary = 0x00bb; // >> right_primary = 0x00ab; // << left_secondary = 0x203a; // > right_secondary = 0x2039; // < break; } - case PlainQuotes: { + case QuoteStyle::PlainQuotes: { left_primary = 0x0022; // " right_primary = 0x0022; // " left_secondary = 0x0027; // ' right_secondary = 0x0027; // ' break; } - case BritishQuotes: { + case QuoteStyle::BritishQuotes: { left_primary = 0x2018; // ` right_primary = 0x2019; // ' left_secondary = 0x201c; // `` right_secondary = 0x201d; // '' break; } - case SwedishGQuotes: { + case QuoteStyle::SwedishGQuotes: { left_primary = 0x00bb; // >> right_primary = 0x00bb; // >> left_secondary = 0x2019; // ' right_secondary = 0x2019; // ' break; } - case FrenchQuotes: { + case QuoteStyle::FrenchQuotes: { left_primary = 0x00ab; // << right_primary = 0x00bb; // >> left_secondary = 0x201c; // `` right_secondary = 0x201d; // '' break; } - case FrenchINQuotes:{ + case QuoteStyle::FrenchINQuotes:{ left_primary = 0x00ab; // << right_primary = 0x00bb; // >> left_secondary = 0x00ab; // << right_secondary = 0x00bb; // >> break; } - case RussianQuotes:{ + case QuoteStyle::RussianQuotes:{ left_primary = 0x00ab; // << right_primary = 0x00bb; // >> left_secondary = 0x201e; // ,, right_secondary = 0x201c; // `` break; } - case CJKQuotes:{ + case QuoteStyle::CJKQuotes:{ left_primary = 0x300c; // LEFT CORNER BRACKET right_primary = 0x300d; // RIGHT CORNER BRACKET left_secondary = 0x300e; // LEFT WHITE CORNER BRACKET right_secondary = 0x300f; // RIGHT WHITE CORNER BRACKET break; } - case CJKAngleQuotes:{ + case QuoteStyle::CJKAngleQuotes:{ left_primary = 0x300a; // LEFT DOUBLE ANGLE BRACKET right_primary = 0x300b; // RIGHT DOUBLE ANGLE BRACKET left_secondary = 0x3008; // LEFT ANGLE BRACKET right_secondary = 0x3009; // RIGHT ANGLE BRACKET break; } - case DynamicQuotes: + case QuoteStyle::DynamicQuotes: default: // should not happen left_primary = 0x003f; // ? @@ -316,14 +316,14 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c } switch (level) { - case SecondaryQuotes: + case QuoteLevel::SecondaryQuotes: if (rtl) - return (side == ClosingQuote) ? left_secondary : right_secondary; - return (side == OpeningQuote) ? left_secondary : right_secondary; - case PrimaryQuotes: + return (side == QuoteSide::ClosingQuote) ? left_secondary : right_secondary; + return (side == QuoteSide::OpeningQuote) ? left_secondary : right_secondary; + case QuoteLevel::PrimaryQuotes: if (rtl) - return (side == ClosingQuote) ? left_primary : right_primary; - return (side == OpeningQuote) ? left_primary : right_primary; + return (side == QuoteSide::ClosingQuote) ? left_primary : right_primary; + return (side == QuoteSide::OpeningQuote) ? left_primary : right_primary; default: break; } @@ -555,12 +555,12 @@ map<string, docstring> InsetQuotesParams::getTypes() const // get all quote types for (sty = 0; sty < stylescount(); ++sty) { style = QuoteStyle(sty); - if (style == DynamicQuotes) + if (style == QuoteStyle::DynamicQuotes) continue; for (sid = 0; sid < 2; ++sid) { side = QuoteSide(sid); for (lev = 0; lev < 2; ++lev) { - type += style_char[style]; + type += style_char[static_cast<int>(style)]; type += side_char[sid]; level = QuoteLevel(lev); type += level_char[lev]; @@ -577,10 +577,10 @@ docstring const InsetQuotesParams::getGuiLabel(QuoteStyle const & qs, bool langd { docstring const styledesc = bformat(_("%1$souter%2$s and %3$sinner%4$s[[quotation marks]]"), - docstring(1, getQuoteChar(qs, PrimaryQuotes, OpeningQuote)), - docstring(1, getQuoteChar(qs, PrimaryQuotes, ClosingQuote)), - docstring(1, getQuoteChar(qs, SecondaryQuotes, OpeningQuote)), - docstring(1, getQuoteChar(qs, SecondaryQuotes, ClosingQuote)) + docstring(1, getQuoteChar(qs, QuoteLevel::PrimaryQuotes, QuoteSide::OpeningQuote)), + docstring(1, getQuoteChar(qs, QuoteLevel::PrimaryQuotes, QuoteSide::ClosingQuote)), + docstring(1, getQuoteChar(qs, QuoteLevel::SecondaryQuotes, QuoteSide::OpeningQuote)), + docstring(1, getQuoteChar(qs, QuoteLevel::SecondaryQuotes, QuoteSide::ClosingQuote)) ); if (!langdef) @@ -598,7 +598,7 @@ docstring const InsetQuotesParams::getShortGuiLabel(docstring const & str) const QuoteSide const side = getQuoteSide(s); QuoteLevel const level = getQuoteLevel(s); - return (side == OpeningQuote) ? + return (side == QuoteSide::OpeningQuote) ? bformat(_("%1$stext"), docstring(1, getQuoteChar(style, level, side))) : bformat(_("text%1$s"), @@ -624,7 +624,7 @@ InsetQuotes::InsetQuotes(Buffer * buf, string const & str) } -InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLevel level, +InsetQuotes::InsetQuotes(Buffer * buf, char_type c, QuoteLevel level, string const & side, string const & style) : Inset(buf), level_(level) { @@ -638,14 +638,14 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLeve fontenc_ = "OT1"; } if (style.empty()) - style_ = dynamic ? InsetQuotesParams::DynamicQuotes : global_style_; + style_ = dynamic ? QuoteStyle::DynamicQuotes : global_style_; else style_ = getStyle(style); if (side == "left" || side == "opening") - side_ = InsetQuotesParams::OpeningQuote; + side_ = QuoteSide::OpeningQuote; else if (side == "right" || side == "closing") - side_ = InsetQuotesParams::ClosingQuote; + side_ = QuoteSide::ClosingQuote; else setSide(c); } @@ -661,9 +661,9 @@ void InsetQuotes::setSide(char_type c) { // Decide whether opening or closing quote if (lyx::isSpace(c) || isOpenPunctuation(c)) - side_ = InsetQuotesParams::OpeningQuote;// opening quote + side_ = QuoteSide::OpeningQuote;// opening quote else - side_ = InsetQuotesParams::ClosingQuote;// closing quote + side_ = QuoteSide::ClosingQuote;// closing quote } @@ -675,40 +675,40 @@ void InsetQuotes::parseString(string const & s, bool const allow_wildcards) } -InsetQuotesParams::QuoteStyle InsetQuotes::getStyle(string const & s) +QuoteStyle InsetQuotes::getStyle(string const & s) { - InsetQuotesParams::QuoteStyle qs = InsetQuotesParams::EnglishQuotes; + QuoteStyle qs = QuoteStyle::EnglishQuotes; if (s == "english") - qs = InsetQuotesParams::EnglishQuotes; + qs = QuoteStyle::EnglishQuotes; else if (s == "swedish") - qs = InsetQuotesParams::SwedishQuotes; + qs = QuoteStyle::SwedishQuotes; else if (s == "german") - qs = InsetQuotesParams::GermanQuotes; + qs = QuoteStyle::GermanQuotes; else if (s == "polish") - qs = InsetQuotesParams::PolishQuotes; + qs = QuoteStyle::PolishQuotes; else if (s == "swiss") - qs = InsetQuotesParams::SwissQuotes; + qs = QuoteStyle::SwissQuotes; else if (s == "danish") - qs = InsetQuotesParams::DanishQuotes; + qs = QuoteStyle::DanishQuotes; else if (s == "plain") - qs = InsetQuotesParams::PlainQuotes; + qs = QuoteStyle::PlainQuotes; else if (s == "british") - qs = InsetQuotesParams::BritishQuotes; + qs = QuoteStyle::BritishQuotes; else if (s == "swedishg") - qs = InsetQuotesParams::SwedishGQuotes; + qs = QuoteStyle::SwedishGQuotes; else if (s == "french") - qs = InsetQuotesParams::FrenchQuotes; + qs = QuoteStyle::FrenchQuotes; else if (s == "frenchin") - qs = InsetQuotesParams::FrenchINQuotes; + qs = QuoteStyle::FrenchINQuotes; else if (s == "russian") - qs = InsetQuotesParams::RussianQuotes; + qs = QuoteStyle::RussianQuotes; else if (s == "cjk") - qs = InsetQuotesParams::CJKQuotes; + qs = QuoteStyle::CJKQuotes; else if (s == "cjkangle") - qs = InsetQuotesParams::CJKAngleQuotes; + qs = QuoteStyle::CJKAngleQuotes; else if (s == "dynamic") - qs = InsetQuotesParams::DynamicQuotes; + qs = QuoteStyle::DynamicQuotes; return qs; } @@ -718,23 +718,23 @@ docstring InsetQuotes::displayString() const { // In PassThru, we use straight quotes if (pass_thru_) - return (level_ == InsetQuotesParams::PrimaryQuotes) ? + return (level_ == QuoteLevel::PrimaryQuotes) ? from_ascii("\"") : from_ascii("'"); - InsetQuotesParams::QuoteStyle style = - (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_; + QuoteStyle style = + (style_ == QuoteStyle::DynamicQuotes) ? global_style_ : style_; docstring retdisp = docstring(1, quoteparams.getQuoteChar(style, level_, side_, rtl_)); // in French, thin spaces are added inside double guillemets if (prefixIs(context_lang_, "fr") - && level_ == InsetQuotesParams::PrimaryQuotes - && (style == InsetQuotesParams::SwissQuotes - || style == InsetQuotesParams::FrenchQuotes - || style == InsetQuotesParams::FrenchINQuotes)) { + && level_ == QuoteLevel::PrimaryQuotes + && (style == QuoteStyle::SwissQuotes + || style == QuoteStyle::FrenchQuotes + || style == QuoteStyle::FrenchINQuotes)) { // THIN SPACE (U+2009) char_type const thin_space = 0x2009; - if (side_ == InsetQuotesParams::OpeningQuote) + if (side_ == QuoteSide::OpeningQuote) retdisp += thin_space; else retdisp = thin_space + retdisp; @@ -757,7 +757,7 @@ void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const void InsetQuotes::draw(PainterInfo & pi, int x, int y) const { FontInfo font = pi.base.font; - if (style_ == InsetQuotesParams::DynamicQuotes) + if (style_ == QuoteStyle::DynamicQuotes) font.setPaintColor(Color_special); else font.setPaintColor(pi.textColor(font.realColor())); @@ -768,9 +768,9 @@ void InsetQuotes::draw(PainterInfo & pi, int x, int y) const string InsetQuotes::getType() const { string text; - text += style_char[style_]; - text += side_char[side_]; - text += level_char[level_]; + text += style_char[static_cast<int>(style_)]; + text += side_char[static_cast<int>(side_)]; + text += level_char[static_cast<int>(level_)]; return text; } @@ -838,18 +838,18 @@ bool InsetQuotes::getStatus(Cursor & cur, FuncRequest const & cmd, void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const { - InsetQuotesParams::QuoteStyle style = - (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_; + QuoteStyle style = + (style_ == QuoteStyle::DynamicQuotes) ? global_style_ : style_; char_type quotechar = quoteparams.getQuoteChar(style, level_, side_, rtl_); docstring qstr; // In pass-thru context, we output plain quotes if (runparams.pass_thru) - qstr = (level_ == InsetQuotesParams::PrimaryQuotes) ? from_ascii("\"") : from_ascii("'"); - else if (style == InsetQuotesParams::PlainQuotes && fontspec_) { + qstr = (level_ == QuoteLevel::PrimaryQuotes) ? from_ascii("\"") : from_ascii("'"); + else if (style == QuoteStyle::PlainQuotes && fontspec_) { // For XeTeX and LuaTeX,we need to disable mapping to get straight // quotes. We define our own commands that do this - qstr = (level_ == InsetQuotesParams::PrimaryQuotes) ? + qstr = (level_ == QuoteLevel::PrimaryQuotes) ? from_ascii("\\textquotedblplain") : from_ascii("\\textquotesingleplain"); } else if (runparams.use_polyglossia) { @@ -859,21 +859,21 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const } // The CJK marks are not yet covered by utf8 inputenc (we don't have the entry in // unicodesymbols, since we don't want to add fake synbols there). - else if (style == InsetQuotesParams::CJKQuotes || style == InsetQuotesParams::CJKAngleQuotes) { + else if (style == QuoteStyle::CJKQuotes || style == QuoteStyle::CJKAngleQuotes) { if (runparams.encoding && runparams.encoding->name() != "utf8" && runparams.encoding->encodable(quotechar)) qstr = docstring(1, quotechar); else qstr = quoteparams.getLaTeXQuote(quotechar, "int"); } - else if ((style == InsetQuotesParams::SwissQuotes - || style == InsetQuotesParams::FrenchQuotes - || style == InsetQuotesParams::FrenchINQuotes) - && level_ == InsetQuotesParams::PrimaryQuotes + else if ((style == QuoteStyle::SwissQuotes + || style == QuoteStyle::FrenchQuotes + || style == QuoteStyle::FrenchINQuotes) + && level_ == QuoteLevel::PrimaryQuotes && prefixIs(runparams.local_font->language()->code(), "fr")) { // Specific guillemets of French babel // including correct French spacing - if (side_ == InsetQuotesParams::OpeningQuote) + if (side_ == QuoteSide::OpeningQuote) qstr = from_ascii("\\og"); else qstr = from_ascii("\\fg"); @@ -944,20 +944,20 @@ int InsetQuotes::plaintext(odocstringstream & os, docstring InsetQuotes::getQuoteEntity(bool isHTML) const { - InsetQuotesParams::QuoteStyle style = - (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_; + QuoteStyle style = + (style_ == QuoteStyle::DynamicQuotes) ? global_style_ : style_; docstring res = isHTML ? quoteparams.getHTMLQuote(quoteparams.getQuoteChar(style, level_, side_)) : quoteparams.getXMLQuote(quoteparams.getQuoteChar(style, level_, side_)); // in French, thin spaces are added inside double guillemets if (prefixIs(context_lang_, "fr") - && level_ == InsetQuotesParams::PrimaryQuotes - && (style == InsetQuotesParams::FrenchQuotes - || style == InsetQuotesParams::FrenchINQuotes - || style == InsetQuotesParams::SwissQuotes)) { + && level_ == QuoteLevel::PrimaryQuotes + && (style == QuoteStyle::FrenchQuotes + || style == QuoteStyle::FrenchINQuotes + || style == QuoteStyle::SwissQuotes)) { // THIN SPACE (U+2009) docstring const thin_space = from_ascii(" "); - if (side_ == InsetQuotesParams::OpeningQuote) // Open quote: space after + if (side_ == QuoteSide::OpeningQuote) // Open quote: space after res += thin_space; else // Close quote: space before res = thin_space + res; @@ -1007,8 +1007,8 @@ void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/, bo void InsetQuotes::validate(LaTeXFeatures & features) const { - InsetQuotesParams::QuoteStyle style = - (style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_; + QuoteStyle style = + (style_ == QuoteStyle::DynamicQuotes) ? global_style_ : style_; char_type type = quoteparams.getQuoteChar(style, level_, side_); // Handle characters that are not natively supported by diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h index 62ba28d9e9..2be62e71dc 100644 --- a/src/insets/InsetQuotes.h +++ b/src/insets/InsetQuotes.h @@ -20,58 +20,62 @@ namespace lyx { +/// +enum class QuoteStyle : int { + /// + EnglishQuotes, + /// + SwedishQuotes, + /// + GermanQuotes, + /// + PolishQuotes, + /// + SwissQuotes, + /// + DanishQuotes, + /// + PlainQuotes, + /// + BritishQuotes, + /// + SwedishGQuotes, + /// + FrenchQuotes, + /// + FrenchINQuotes, + /// + RussianQuotes, + /// + CJKQuotes, + /// + CJKAngleQuotes, + /// + DynamicQuotes +}; + +/// +enum class QuoteSide : int { + /// + OpeningQuote, + /// + ClosingQuote +}; + +/// +enum class QuoteLevel : int { + /// + SecondaryQuotes, + /// + PrimaryQuotes +}; + + /** Quotes. Used for the various quotes. German, English, French, all either double or single **/ class InsetQuotesParams { public: - /// - enum QuoteStyle { - /// - EnglishQuotes, - /// - SwedishQuotes, - /// - GermanQuotes, - /// - PolishQuotes, - /// - SwissQuotes, - /// - DanishQuotes, - /// - PlainQuotes, - /// - BritishQuotes, - /// - SwedishGQuotes, - /// - FrenchQuotes, - /// - FrenchINQuotes, - /// - RussianQuotes, - /// - CJKQuotes, - /// - CJKAngleQuotes, - /// - DynamicQuotes - }; - /// - enum QuoteSide { - /// - OpeningQuote, - /// - ClosingQuote - }; - /// - enum QuoteLevel { - /// - SecondaryQuotes, - /// - PrimaryQuotes - }; /// Returns the unicode character of a given quote char_type getQuoteChar(QuoteStyle const &, QuoteLevel const &, QuoteSide const &, bool const rtl = false) const; @@ -96,15 +100,15 @@ public: /// Returns the quote style from the shortcut string QuoteStyle getQuoteStyle(std::string const & s, bool const allow_wildcards = false, - QuoteStyle fallback = EnglishQuotes) const; + QuoteStyle fallback = QuoteStyle::EnglishQuotes) const; /// Returns the quote sind from the shortcut string QuoteSide getQuoteSide(std::string const & s, bool const allow_wildcards = false, - QuoteSide fallback = OpeningQuote) const; + QuoteSide fallback = QuoteSide::OpeningQuote) const; /// Returns the quote level from the shortcut string QuoteLevel getQuoteLevel(std::string const & s, bool const allow_wildcards = false, - QuoteLevel fallback = PrimaryQuotes) const; + QuoteLevel fallback = QuoteLevel::PrimaryQuotes) const; }; /// @@ -125,7 +129,7 @@ public: */ explicit InsetQuotes(Buffer * buf, std::string const & str = "eld"); /// Direct access to inner/outer quotation marks - InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLevel level, + InsetQuotes(Buffer * buf, char_type c, QuoteLevel level, std::string const & side = std::string(), std::string const & style = std::string()); /// @@ -184,16 +188,16 @@ private: /// docstring getQuoteEntity(bool isHTML) const; /// - InsetQuotesParams::QuoteStyle getStyle(std::string const &); + QuoteStyle getStyle(std::string const &); /// - InsetQuotesParams::QuoteStyle style_ = InsetQuotesParams::EnglishQuotes; + QuoteStyle style_ = QuoteStyle::EnglishQuotes; /// - InsetQuotesParams::QuoteSide side_ = InsetQuotesParams::OpeningQuote; + QuoteSide side_ = QuoteSide::OpeningQuote; /// - InsetQuotesParams::QuoteLevel level_ = InsetQuotesParams::PrimaryQuotes; + QuoteLevel level_ = QuoteLevel::PrimaryQuotes; /// - InsetQuotesParams::QuoteStyle global_style_ = InsetQuotesParams::EnglishQuotes; + QuoteStyle global_style_ = QuoteStyle::EnglishQuotes; /// Current font encoding std::string fontenc_; /// Code of the contextual language diff --git a/src/output_plaintext.cpp b/src/output_plaintext.cpp index 9dae951f03..b0450bda9f 100644 --- a/src/output_plaintext.cpp +++ b/src/output_plaintext.cpp @@ -21,6 +21,8 @@ #include "ParagraphList.h" #include "ParagraphParameters.h" +#include "insets/Inset.h" + #include "support/debug.h" #include "support/gettext.h" #include "support/lstrings.h" -- 2.28.0.windows.1
From c259dca7323b2fcb8adde877c7c36b0e7f97ceec Mon Sep 17 00:00:00 2001 From: Yuriy Skalko <yuriy.ska...@gmail.com> Date: Mon, 30 Nov 2020 22:46:46 +0200 Subject: [PATCH 3/4] Refactor KernelDocType enum --- src/frontends/qt/Dialog.cpp | 6 +++--- src/frontends/qt/Dialog.h | 2 +- src/frontends/qt/Validator.cpp | 7 ++++--- src/frontends/qt/Validator.h | 5 ++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/frontends/qt/Dialog.cpp b/src/frontends/qt/Dialog.cpp index 7590a54ae6..509727d1c3 100644 --- a/src/frontends/qt/Dialog.cpp +++ b/src/frontends/qt/Dialog.cpp @@ -91,12 +91,12 @@ QString Dialog::bufferFilePath() const KernelDocType Dialog::docType() const { if (buffer().params().isLatex()) - return LATEX; + return KernelDocType::LATEX; if (buffer().params().isLiterate()) - return LITERATE; + return KernelDocType::LITERATE; // This case should not happen. - return LATEX; + return KernelDocType::LATEX; } diff --git a/src/frontends/qt/Dialog.h b/src/frontends/qt/Dialog.h index b4a3c8d4e6..819dcf9e2a 100644 --- a/src/frontends/qt/Dialog.h +++ b/src/frontends/qt/Dialog.h @@ -38,7 +38,7 @@ class GuiView; * without making the kernel header files available to the * dialog's Controller or View. */ -enum KernelDocType +enum class KernelDocType : int { LATEX, LITERATE diff --git a/src/frontends/qt/Validator.cpp b/src/frontends/qt/Validator.cpp index 0fddd6d094..1f72d5625e 100644 --- a/src/frontends/qt/Validator.cpp +++ b/src/frontends/qt/Validator.cpp @@ -13,14 +13,15 @@ #include <config.h> #include "Validator.h" -#include "qt_helpers.h" -#include "support/gettext.h" +#include "Dialog.h" #include "LyXRC.h" +#include "qt_helpers.h" #include "frontends/alert.h" #include "support/docstring.h" +#include "support/gettext.h" #include "support/lstrings.h" #include <QLineEdit> @@ -233,7 +234,7 @@ QValidator::State PathValidator::validate(QString & qtext, int &) const void PathValidator::setChecker(KernelDocType const & type, LyXRC const & rc) { - latex_doc_ = type == LATEX; + latex_doc_ = type == KernelDocType::LATEX; tex_allows_spaces_ = rc.tex_allows_spaces; } diff --git a/src/frontends/qt/Validator.h b/src/frontends/qt/Validator.h index 72d08ae3a9..87a1a1c91f 100644 --- a/src/frontends/qt/Validator.h +++ b/src/frontends/qt/Validator.h @@ -25,8 +25,6 @@ #ifndef VALIDATOR_H #define VALIDATOR_H -#include "Dialog.h" // KernelDocType - #include "support/Length.h" #include <QValidator> @@ -34,13 +32,14 @@ class QWidget; class QLineEdit; - namespace lyx { class LyXRC; namespace frontend { +enum class KernelDocType : int; + /** A class to ascertain whether the data passed to the @c validate() * member function can be interpreted as a GlueLength. */ -- 2.28.0.windows.1
From abb6d3c3ec016b3acad503ea0c0bbf84ce69f8db Mon Sep 17 00:00:00 2001 From: Yuriy Skalko <yuriy.ska...@gmail.com> Date: Tue, 1 Dec 2020 00:00:40 +0200 Subject: [PATCH 4/4] Better naming for enums --- src/Buffer.cpp | 34 +++---- src/BufferParams.cpp | 80 ++++++++-------- src/BufferParams.h | 6 +- src/Converter.cpp | 26 +++--- src/Converter.h | 4 +- src/Format.cpp | 24 ++--- src/Format.h | 6 +- src/LaTeXFeatures.cpp | 20 ++-- src/OutputParams.cpp | 18 ++-- src/OutputParams.h | 22 ++--- src/PDFOptions.cpp | 4 +- src/Paragraph.cpp | 6 +- src/Text3.cpp | 2 +- src/frontends/qt/Dialog.cpp | 6 +- src/frontends/qt/Dialog.h | 4 +- src/frontends/qt/GuiDocument.cpp | 2 +- src/frontends/qt/Validator.cpp | 2 +- src/graphics/PreviewLoader.cpp | 24 ++--- src/insets/InsetBibtex.cpp | 2 +- src/insets/InsetExternal.cpp | 22 ++--- src/insets/InsetGraphics.cpp | 14 +-- src/insets/InsetInclude.cpp | 2 +- src/insets/InsetNote.cpp | 2 +- src/insets/InsetQuotes.cpp | 156 +++++++++++++++---------------- src/insets/InsetQuotes.h | 52 +++++------ src/lyxfind.cpp | 10 +- 26 files changed, 275 insertions(+), 275 deletions(-) diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 64513fada1..0d5de8c78c 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2321,7 +2321,7 @@ int Buffer::runChktex() // Generate the LaTeX file if neccessary OutputParams runparams(¶ms().encoding()); - runparams.flavor = FLAVOR::LATEX; + runparams.flavor = Flavor::LaTeX; runparams.nice = false; runparams.linelen = lyxrc.plaintext_linelen; ExportStatus const retval = @@ -4069,23 +4069,23 @@ unique_ptr<TexRow> Buffer::getSourceCode(odocstream & os, string const & format, << "\n\n"; } // output paragraphs - if (runparams.flavor == FLAVOR::LYX) { + if (runparams.flavor == Flavor::LyX) { Paragraph const & par = text().paragraphs()[par_begin]; ostringstream ods; depth_type dt = par.getDepth(); par.write(ods, params(), dt); os << from_utf8(ods.str()); - } else if (runparams.flavor == FLAVOR::HTML) { + } else if (runparams.flavor == Flavor::Html) { XMLStream xs(os); setMathFlavor(runparams); xhtmlParagraphs(text(), *this, xs, runparams); - } else if (runparams.flavor == FLAVOR::TEXT) { + } else if (runparams.flavor == Flavor::Text) { bool dummy = false; // FIXME Handles only one paragraph, unlike the others. // Probably should have some routine with a signature like them. writePlaintextParagraph(*this, text().paragraphs()[par_begin], os, runparams, dummy); - } else if (runparams.flavor == FLAVOR::DOCBOOK5) { + } else if (runparams.flavor == Flavor::DocBook5) { XMLStream xs{os}; docbookParagraphs(text(), *this, xs, runparams); } else { @@ -4123,7 +4123,7 @@ unique_ptr<TexRow> Buffer::getSourceCode(odocstream & os, string const & format, else if (output == OnlyBody) os << _("Preview body"); os << "\n\n"; - if (runparams.flavor == FLAVOR::LYX) { + if (runparams.flavor == Flavor::LyX) { ostringstream ods; if (output == FullSource) write(ods); @@ -4132,14 +4132,14 @@ unique_ptr<TexRow> Buffer::getSourceCode(odocstream & os, string const & format, else if (output == OnlyBody) text().write(ods); os << from_utf8(ods.str()); - } else if (runparams.flavor == FLAVOR::HTML) { + } else if (runparams.flavor == Flavor::Html) { writeLyXHTMLSource(os, runparams, output); - } else if (runparams.flavor == FLAVOR::TEXT) { + } else if (runparams.flavor == Flavor::Text) { if (output == OnlyPreamble) { os << "% "<< _("Plain text does not have a preamble."); } else writePlaintextFile(*this, os, runparams); - } else if (runparams.flavor == FLAVOR::DOCBOOK5) { + } else if (runparams.flavor == Flavor::DocBook5) { writeDocBookSource(os, runparams, output); } else { // latex or literate @@ -4374,7 +4374,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir } MarkAsExporting exporting(this); string backend_format; - runparams.flavor = FLAVOR::LATEX; + runparams.flavor = Flavor::LaTeX; runparams.linelen = lyxrc.plaintext_linelen; runparams.includeall = includeall; vector<string> backs = params().backends(); @@ -4418,13 +4418,13 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir LYXERR(Debug::FILES, "backend_format=" << backend_format); // FIXME: Don't hardcode format names here, but use a flag if (backend_format == "pdflatex") - runparams.flavor = FLAVOR::PDFLATEX; + runparams.flavor = Flavor::PdfLaTeX; else if (backend_format == "luatex") - runparams.flavor = FLAVOR::LUATEX; + runparams.flavor = Flavor::LuaTeX; else if (backend_format == "dviluatex") - runparams.flavor = FLAVOR::DVILUATEX; + runparams.flavor = Flavor::DviLuaTeX; else if (backend_format == "xetex") - runparams.flavor = FLAVOR::XETEX; + runparams.flavor = Flavor::XeTeX; } string filename = latexName(false); @@ -4435,7 +4435,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir // Plain text backend if (backend_format == "text") { - runparams.flavor = FLAVOR::TEXT; + runparams.flavor = Flavor::Text; try { writePlaintextFile(*this, FileName(filename), runparams); } @@ -4443,7 +4443,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir } // HTML backend else if (backend_format == "xhtml") { - runparams.flavor = FLAVOR::HTML; + runparams.flavor = Flavor::Html; setMathFlavor(runparams); if (makeLyXHTMLFile(FileName(filename), runparams) == ExportKilled) return ExportKilled; @@ -4451,7 +4451,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir writeFile(FileName(filename)); // DocBook backend else if (backend_format == "docbook5") { - runparams.flavor = FLAVOR::DOCBOOK5; + runparams.flavor = Flavor::DocBook5; runparams.nice = false; if (makeDocBookFile(FileName(filename), runparams) == ExportKilled) return ExportKilled; diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 798c773557..ea60c75d64 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -142,20 +142,20 @@ typedef Translator<string, QuoteStyle> QuotesStyleTranslator; QuotesStyleTranslator const init_quotesstyletranslator() { QuotesStyleTranslator translator - (string_quotes_style[0], QuoteStyle::EnglishQuotes); - translator.addPair(string_quotes_style[1], QuoteStyle::SwedishQuotes); - translator.addPair(string_quotes_style[2], QuoteStyle::GermanQuotes); - translator.addPair(string_quotes_style[3], QuoteStyle::PolishQuotes); - translator.addPair(string_quotes_style[4], QuoteStyle::SwissQuotes); - translator.addPair(string_quotes_style[5], QuoteStyle::DanishQuotes); - translator.addPair(string_quotes_style[6], QuoteStyle::PlainQuotes); - translator.addPair(string_quotes_style[7], QuoteStyle::BritishQuotes); - translator.addPair(string_quotes_style[8], QuoteStyle::SwedishGQuotes); - translator.addPair(string_quotes_style[9], QuoteStyle::FrenchQuotes); - translator.addPair(string_quotes_style[10], QuoteStyle::FrenchINQuotes); - translator.addPair(string_quotes_style[11], QuoteStyle::RussianQuotes); - translator.addPair(string_quotes_style[12], QuoteStyle::CJKQuotes); - translator.addPair(string_quotes_style[13], QuoteStyle::CJKAngleQuotes); + (string_quotes_style[0], QuoteStyle::English); + translator.addPair(string_quotes_style[1], QuoteStyle::Swedish); + translator.addPair(string_quotes_style[2], QuoteStyle::German); + translator.addPair(string_quotes_style[3], QuoteStyle::Polish); + translator.addPair(string_quotes_style[4], QuoteStyle::Swiss); + translator.addPair(string_quotes_style[5], QuoteStyle::Danish); + translator.addPair(string_quotes_style[6], QuoteStyle::Plain); + translator.addPair(string_quotes_style[7], QuoteStyle::British); + translator.addPair(string_quotes_style[8], QuoteStyle::SwedishG); + translator.addPair(string_quotes_style[9], QuoteStyle::French); + translator.addPair(string_quotes_style[10], QuoteStyle::FrenchIN); + translator.addPair(string_quotes_style[11], QuoteStyle::Russian); + translator.addPair(string_quotes_style[12], QuoteStyle::CJK); + translator.addPair(string_quotes_style[13], QuoteStyle::CJKAngle); return translator; } @@ -394,7 +394,7 @@ BufferParams::BufferParams() paragraph_separation = ParagraphIndentSeparation; is_math_indent = false; math_numbering_side = DEFAULT; - quotes_style = QuoteStyle::EnglishQuotes; + quotes_style = QuoteStyle::English; dynamic_quotes = false; fontsize = "default"; @@ -1522,8 +1522,8 @@ void BufferParams::validate(LaTeXFeatures & features) const LaTeXFeatures::isAvailable("xcolor"); switch (features.runparams().flavor) { - case FLAVOR::LATEX: - case FLAVOR::DVILUATEX: + case Flavor::LaTeX: + case Flavor::DviLuaTeX: if (xcolorulem) { features.require("ct-xcolor-ulem"); features.require("ulem"); @@ -1532,9 +1532,9 @@ void BufferParams::validate(LaTeXFeatures & features) const features.require("ct-none"); } break; - case FLAVOR::LUATEX: - case FLAVOR::PDFLATEX: - case FLAVOR::XETEX: + case Flavor::LuaTeX: + case Flavor::PdfLaTeX: + case Flavor::XeTeX: if (xcolorulem) { features.require("ct-xcolor-ulem"); features.require("ulem"); @@ -2067,9 +2067,9 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, if (output_sync) { if (!output_sync_macro.empty()) os << from_utf8(output_sync_macro) +"\n"; - else if (features.runparams().flavor == FLAVOR::LATEX) + else if (features.runparams().flavor == Flavor::LaTeX) os << "\\usepackage[active]{srcltx}\n"; - else if (features.runparams().flavor == FLAVOR::PDFLATEX) + else if (features.runparams().flavor == Flavor::PdfLaTeX) os << "\\synctex=-1\n"; } @@ -2346,7 +2346,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, && !features.isProvided("xunicode")) { // The `xunicode` package officially only supports XeTeX, // but also works with LuaTeX. We work around its XeTeX test. - if (features.runparams().flavor != FLAVOR::XETEX) { + if (features.runparams().flavor != Flavor::XeTeX) { os << "% Pretend to xunicode that we are XeTeX\n" << "\\def\\XeTeXpicfile{}\n"; } @@ -2713,7 +2713,7 @@ vector<string> BufferParams::backends() const } -FLAVOR BufferParams::getOutputFlavor(string const & format) const +Flavor BufferParams::getOutputFlavor(string const & format) const { string const dformat = (format.empty() || format == "default") ? getDefaultOutputFormat() : format; @@ -2723,26 +2723,26 @@ FLAVOR BufferParams::getOutputFlavor(string const & format) const if (it != default_flavors_.end()) return it->second; - FLAVOR result = FLAVOR::LATEX; + Flavor result = Flavor::LaTeX; // FIXME It'd be better not to hardcode this, but to do // something with formats. if (dformat == "xhtml") - result = FLAVOR::HTML; + result = Flavor::Html; else if (dformat == "docbook5") - result = FLAVOR::DOCBOOK5; + result = Flavor::DocBook5; else if (dformat == "text") - result = FLAVOR::TEXT; + result = Flavor::Text; else if (dformat == "lyx") - result = FLAVOR::LYX; + result = Flavor::LyX; else if (dformat == "pdflatex") - result = FLAVOR::PDFLATEX; + result = Flavor::PdfLaTeX; else if (dformat == "xetex") - result = FLAVOR::XETEX; + result = Flavor::XeTeX; else if (dformat == "luatex") - result = FLAVOR::LUATEX; + result = Flavor::LuaTeX; else if (dformat == "dviluatex") - result = FLAVOR::DVILUATEX; + result = Flavor::DviLuaTeX; else { // Try to determine flavor of default output format vector<string> backs = backends(); @@ -3256,8 +3256,8 @@ void BufferParams::writeEncodingPreamble(otexstream & os, // Create list of inputenc options: set<string> encoding_set; // luainputenc fails with more than one encoding - if (features.runparams().flavor != FLAVOR::LUATEX - && features.runparams().flavor != FLAVOR::DVILUATEX) + if (features.runparams().flavor != Flavor::LuaTeX + && features.runparams().flavor != Flavor::DviLuaTeX) // list all input encodings used in the document encoding_set = features.getEncodingSet(doc_encoding); @@ -3281,8 +3281,8 @@ void BufferParams::writeEncodingPreamble(otexstream & os, os << ','; os << from_ascii(doc_encoding); } - if (features.runparams().flavor == FLAVOR::LUATEX - || features.runparams().flavor == FLAVOR::DVILUATEX) + if (features.runparams().flavor == Flavor::LuaTeX + || features.runparams().flavor == Flavor::DviLuaTeX) os << "]{luainputenc}\n"; else os << "]{inputenc}\n"; @@ -3305,8 +3305,8 @@ void BufferParams::writeEncodingPreamble(otexstream & os, || features.isProvided("inputenc")) break; os << "\\usepackage[" << from_ascii(encoding().latexName()); - if (features.runparams().flavor == FLAVOR::LUATEX - || features.runparams().flavor == FLAVOR::DVILUATEX) + if (features.runparams().flavor == Flavor::LuaTeX + || features.runparams().flavor == Flavor::DviLuaTeX) os << "]{luainputenc}\n"; else os << "]{inputenc}\n"; @@ -3367,7 +3367,7 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const bool const babelfonts = features.useBabel() && features.isAvailable("babel-2017/11/03"); string const texmapping = - (features.runparams().flavor == FLAVOR::XETEX) ? + (features.runparams().flavor == Flavor::XeTeX) ? "Mapping=tex-text" : "Ligatures=TeX"; if (fontsRoman() != "default") { if (babelfonts) diff --git a/src/BufferParams.h b/src/BufferParams.h index 031524fe1a..578070eb6c 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -52,7 +52,7 @@ class PDFOptions; class Spacing; class VSpace; -enum class FLAVOR : int; +enum class Flavor : int; enum class QuoteStyle : int; /** Buffer parameters. @@ -198,7 +198,7 @@ public: /// return the default output format of the current backend std::string getDefaultOutputFormat() const; /// return the output flavor of \p format or the default - FLAVOR getOutputFlavor(std::string const & format = std::string()) const; + Flavor getOutputFlavor(std::string const & format = std::string()) const; /// bool isExportable(std::string const & format, bool need_viewable) const; /// @@ -617,7 +617,7 @@ private: /// void readIncludeonly(Lexer &); /// A cache for the default flavors - typedef std::map<std::string, FLAVOR> DefaultFlavorCache; + typedef std::map<std::string, Flavor> DefaultFlavorCache; /// mutable DefaultFlavorCache default_flavors_; /// the cite engine diff --git a/src/Converter.cpp b/src/Converter.cpp index 138980b5f4..b4340c8f52 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -259,28 +259,28 @@ void Converters::updateLast(Formats const & formats) } -FLAVOR Converters::getFlavor(Graph::EdgePath const & path, +Flavor Converters::getFlavor(Graph::EdgePath const & path, Buffer const * buffer) const { for (auto const & edge : path) { Converter const & conv = converterlist_[edge]; if (conv.latex() || conv.need_aux()) { if (conv.latex_flavor() == "latex") - return FLAVOR::LATEX; + return Flavor::LaTeX; if (conv.latex_flavor() == "xelatex") - return FLAVOR::XETEX; + return Flavor::XeTeX; if (conv.latex_flavor() == "lualatex") - return FLAVOR::LUATEX; + return Flavor::LuaTeX; if (conv.latex_flavor() == "dvilualatex") - return FLAVOR::DVILUATEX; + return Flavor::DviLuaTeX; if (conv.latex_flavor() == "pdflatex") - return FLAVOR::PDFLATEX; + return Flavor::PdfLaTeX; } if (conv.docbook()) - return FLAVOR::DOCBOOK5; + return Flavor::DocBook5; } return buffer ? buffer->params().getOutputFlavor() - : FLAVOR::LATEX; + : Flavor::LaTeX; } @@ -602,16 +602,16 @@ Converters::RetVal Converters::convert(Buffer const * buffer, LASSERT(buffer, return FAILURE); string command; switch (runparams.flavor) { - case FLAVOR::DVILUATEX: + case Flavor::DviLuaTeX: command = dvilualatex_command_; break; - case FLAVOR::LUATEX: + case Flavor::LuaTeX: command = lualatex_command_; break; - case FLAVOR::PDFLATEX: + case Flavor::PdfLaTeX: command = pdflatex_command_; break; - case FLAVOR::XETEX: + case Flavor::XeTeX: command = xelatex_command_; break; default: @@ -833,7 +833,7 @@ bool Converters::scanLog(Buffer const & buffer, string const & /*command*/, FileName const & filename, ErrorList & errorList) { OutputParams runparams(nullptr); - runparams.flavor = FLAVOR::LATEX; + runparams.flavor = Flavor::LaTeX; LaTeX latex("", runparams, filename); TeXErrors terr; int const result = latex.scanLogFile(terr); diff --git a/src/Converter.h b/src/Converter.h index ca60e16696..5197e3447a 100644 --- a/src/Converter.h +++ b/src/Converter.h @@ -30,7 +30,7 @@ class Format; class Formats; class OutputParams; -enum class FLAVOR : int; +enum class Flavor : int; class ConversionException : public std::exception { public: @@ -177,7 +177,7 @@ public: /// Graph::EdgePath getPath(std::string const & from, std::string const & to); /// - FLAVOR getFlavor(Graph::EdgePath const & path, + Flavor getFlavor(Graph::EdgePath const & path, Buffer const * buffer = nullptr) const; /// std::string getHyperrefDriver(Graph::EdgePath const & path) const; diff --git a/src/Format.cpp b/src/Format.cpp index 9c27c43651..aa4e724b48 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -819,20 +819,20 @@ string const Formats::extensions(string const & name) const namespace { -typedef Translator<FLAVOR, string> FlavorTranslator; +typedef Translator<Flavor, string> FlavorTranslator; FlavorTranslator initFlavorTranslator() { - FlavorTranslator f(FLAVOR::LATEX, "latex"); - f.addPair(FLAVOR::DVILUATEX, "dviluatex"); - f.addPair(FLAVOR::LUATEX, "luatex"); - f.addPair(FLAVOR::PDFLATEX, "pdflatex"); - f.addPair(FLAVOR::XETEX, "xetex"); - f.addPair(FLAVOR::DOCBOOK5, "docbook-xml"); - f.addPair(FLAVOR::HTML, "xhtml"); - f.addPair(FLAVOR::TEXT, "text"); - f.addPair(FLAVOR::LYX, "lyx"); + FlavorTranslator f(Flavor::LaTeX, "latex"); + f.addPair(Flavor::DviLuaTeX, "dviluatex"); + f.addPair(Flavor::LuaTeX, "luatex"); + f.addPair(Flavor::PdfLaTeX, "pdflatex"); + f.addPair(Flavor::XeTeX, "xetex"); + f.addPair(Flavor::DocBook5, "docbook-xml"); + f.addPair(Flavor::Html, "xhtml"); + f.addPair(Flavor::Text, "text"); + f.addPair(Flavor::LyX, "lyx"); return f; } @@ -846,14 +846,14 @@ FlavorTranslator const & flavorTranslator() } // namespace -std::string flavor2format(FLAVOR flavor) +std::string flavor2format(Flavor flavor) { return flavorTranslator().find(flavor); } /* Not currently needed, but I'll leave the code in case it is. -FLAVOR format2flavor(std::string fmt) +Flavor format2flavor(std::string fmt) { return flavorTranslator().find(fmt); } */ diff --git a/src/Format.h b/src/Format.h index b4cc9f4fc4..bdf565708e 100644 --- a/src/Format.h +++ b/src/Format.h @@ -23,7 +23,7 @@ namespace support { class FileName; } class Buffer; -enum class FLAVOR : int; +enum class Flavor : int; class Format { public: @@ -219,9 +219,9 @@ private: }; /// -std::string flavor2format(FLAVOR flavor); +std::string flavor2format(Flavor flavor); // Not currently used. -// FLAVOR format2flavor(std::string fmt); +// Flavor format2flavor(std::string fmt); /// The global instance. /// Implementation is in LyX.cpp. diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 8a515a1405..7c23a851ca 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -1263,8 +1263,8 @@ string const LaTeXFeatures::getPackages() const if (mustProvide("changebar")) { packages << "\\usepackage"; - if (runparams_.flavor == FLAVOR::LATEX - || runparams_.flavor == FLAVOR::DVILUATEX) + if (runparams_.flavor == Flavor::LaTeX + || runparams_.flavor == Flavor::DviLuaTeX) packages << "[dvips]"; packages << "{changebar}\n"; } @@ -1278,8 +1278,8 @@ string const LaTeXFeatures::getPackages() const // [pdf]lscape is used to rotate longtables if (mustProvide("lscape")) { - if (runparams_.flavor == FLAVOR::LATEX - || runparams_.flavor == FLAVOR::DVILUATEX) + if (runparams_.flavor == Flavor::LaTeX + || runparams_.flavor == Flavor::DviLuaTeX) packages << "\\usepackage{lscape}\n"; else packages << "\\usepackage{pdflscape}\n"; @@ -1526,10 +1526,10 @@ TexString LaTeXFeatures::getMacros() const macros << "\\XeTeXdashbreakstate 0" << '\n'; if (mustProvide("papersize")) { - if (runparams_.flavor == FLAVOR::LATEX - || runparams_.flavor == FLAVOR::DVILUATEX) + if (runparams_.flavor == Flavor::LaTeX + || runparams_.flavor == Flavor::DviLuaTeX) macros << papersizedvi_def << '\n'; - else if (runparams_.flavor == FLAVOR::LUATEX) + else if (runparams_.flavor == Flavor::LuaTeX) macros << papersizepdflua_def << '\n'; else macros << papersizepdf_def << '\n'; @@ -1655,13 +1655,13 @@ TexString LaTeXFeatures::getMacros() const if (mustProvide("textquotedbl")) macros << textquotedbl_def << '\n'; if (mustProvide("textquotesinglep")) { - if (runparams_.flavor == FLAVOR::XETEX) + if (runparams_.flavor == Flavor::XeTeX) macros << textquotesinglep_xetex_def << '\n'; else macros << textquotesinglep_luatex_def << '\n'; } if (mustProvide("textquotedblp")) { - if (runparams_.flavor == FLAVOR::XETEX) + if (runparams_.flavor == Flavor::XeTeX) macros << textquotedblp_xetex_def << '\n'; else macros << textquotedblp_luatex_def << '\n'; @@ -1689,7 +1689,7 @@ TexString LaTeXFeatures::getMacros() const if (mustProvide("lyxgreyedout")) { // We need different version for RTL (#8647) if (hasRTLLanguage()) { - if (runparams_.flavor == FLAVOR::LUATEX) + if (runparams_.flavor == Flavor::LuaTeX) if (useBabel()) macros << lyxgreyedout_luartl_babel_def; else diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index 516db84480..dd98c52bbc 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -36,25 +36,25 @@ OutputParams::~OutputParams() bool OutputParams::isLaTeX() const { - return flavor == FLAVOR::LATEX - || flavor == FLAVOR::LUATEX - || flavor == FLAVOR::DVILUATEX - || flavor == FLAVOR::PDFLATEX - || flavor == FLAVOR::XETEX; + return flavor == Flavor::LaTeX + || flavor == Flavor::LuaTeX + || flavor == Flavor::DviLuaTeX + || flavor == Flavor::PdfLaTeX + || flavor == Flavor::XeTeX; } bool OutputParams::isFullUnicode() const { - return flavor == FLAVOR::LUATEX - || flavor == FLAVOR::DVILUATEX - || flavor == FLAVOR::XETEX; + return flavor == Flavor::LuaTeX + || flavor == Flavor::DviLuaTeX + || flavor == Flavor::XeTeX; } bool OutputParams::useBidiPackage() const { - return use_polyglossia && flavor == FLAVOR::XETEX; + return use_polyglossia && flavor == Flavor::XeTeX; } } // namespace lyx diff --git a/src/OutputParams.h b/src/OutputParams.h index 7eb4349767..c04ada1a30 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -29,16 +29,16 @@ class Language; class InsetArgument; -enum class FLAVOR : int { - DVILUATEX, - LATEX, - LUATEX, - PDFLATEX, - XETEX, - DOCBOOK5, - HTML, - TEXT, - LYX +enum class Flavor : int { + DviLuaTeX, + LaTeX, + LuaTeX, + PdfLaTeX, + XeTeX, + DocBook5, + Html, + Text, + LyX }; enum class CtObject : int { @@ -78,7 +78,7 @@ public: /** The file that we export depends occasionally on what is to compile the file. */ - FLAVOR flavor = FLAVOR::LATEX; + Flavor flavor = Flavor::LaTeX; /// is it some flavor of LaTeX? bool isLaTeX() const; /// does this flavour support full unicode? diff --git a/src/PDFOptions.cpp b/src/PDFOptions.cpp index f758c146b7..ee2193fbc1 100644 --- a/src/PDFOptions.cpp +++ b/src/PDFOptions.cpp @@ -191,7 +191,7 @@ void PDFOptions::writeLaTeX(OutputParams & runparams, otexstream & os, // this if the current input encoding does not support a character. // FIXME: don't use \inputencoding if "inputenc" is not loaded (#9839). if (need_unicode && enc && enc->iconvName() != "UTF-8") { - if (runparams.flavor != FLAVOR::XETEX) + if (runparams.flavor != Flavor::XeTeX) os << "\\inputencoding{utf8}\n"; os << setEncoding("UTF-8"); } @@ -211,7 +211,7 @@ void PDFOptions::writeLaTeX(OutputParams & runparams, otexstream & os, os << from_utf8(opt); if (need_unicode && enc && enc->iconvName() != "UTF-8") { os << setEncoding(enc->iconvName()); - if (runparams.flavor != FLAVOR::XETEX) + if (runparams.flavor != Flavor::XeTeX) os << "\\inputencoding{" << from_ascii(enc->latexName()) << "}\n"; } } diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 7db4a3ecca..1116ad62b2 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1236,7 +1236,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, && !runparams.inIPA // TODO #10961: && not in inset Flex Code // TODO #10961: && not in layout LyXCode - && (!bparams.useNonTeXFonts || runparams.flavor != FLAVOR::XETEX)) { + && (!bparams.useNonTeXFonts || runparams.flavor != Flavor::XeTeX)) { if (c == 0x2013) { // en-dash os << "--"; @@ -1390,7 +1390,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const features.addPreambleSnippet(os.release(), true); } - if (features.runparams().flavor == FLAVOR::HTML + if (features.runparams().flavor == Flavor::Html && layout_->htmltitle()) { features.setHTMLTitle(owner_->asString(AS_STR_INSETS | AS_STR_SKIPDELETE)); } @@ -1485,7 +1485,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const } else if (!bp.use_dash_ligatures && (c == 0x2013 || c == 0x2014) && bp.useNonTeXFonts - && features.runparams().flavor == FLAVOR::XETEX) + && features.runparams().flavor == Flavor::XeTeX) // XeTeX's dash behaviour is determined via a global setting features.require("xetexdashbreakstate"); BufferEncodings::validate(c, features); diff --git a/src/Text3.cpp b/src/Text3.cpp index 37eae57af8..1d2f5618ea 100644 --- a/src/Text3.cpp +++ b/src/Text3.cpp @@ -1782,7 +1782,7 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd) } } QuoteLevel const quote_level = inner - ? QuoteLevel::SecondaryQuotes : QuoteLevel::PrimaryQuotes; + ? QuoteLevel::Secondary : QuoteLevel::Primary; cur.insert(new InsetQuotes(cur.buffer(), c, quote_level, cmd.getArg(1), cmd.getArg(2))); cur.buffer()->updateBuffer(); cur.posForward(); diff --git a/src/frontends/qt/Dialog.cpp b/src/frontends/qt/Dialog.cpp index 509727d1c3..f929c0e1b9 100644 --- a/src/frontends/qt/Dialog.cpp +++ b/src/frontends/qt/Dialog.cpp @@ -91,12 +91,12 @@ QString Dialog::bufferFilePath() const KernelDocType Dialog::docType() const { if (buffer().params().isLatex()) - return KernelDocType::LATEX; + return KernelDocType::LaTeX; if (buffer().params().isLiterate()) - return KernelDocType::LITERATE; + return KernelDocType::Literate; // This case should not happen. - return KernelDocType::LATEX; + return KernelDocType::LaTeX; } diff --git a/src/frontends/qt/Dialog.h b/src/frontends/qt/Dialog.h index 819dcf9e2a..b4e6045366 100644 --- a/src/frontends/qt/Dialog.h +++ b/src/frontends/qt/Dialog.h @@ -40,8 +40,8 @@ class GuiView; */ enum class KernelDocType : int { - LATEX, - LITERATE + LaTeX, + Literate }; /** \c Dialog collects the different parts of a Model-Controller-View diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp index 281bab3870..4918381327 100644 --- a/src/frontends/qt/GuiDocument.cpp +++ b/src/frontends/qt/GuiDocument.cpp @@ -2267,7 +2267,7 @@ void GuiDocument::updateQuoteStyles(bool const set) bool has_default = false; for (int i = 0; i < quoteparams.stylescount(); ++i) { QuoteStyle qs = QuoteStyle(i); - if (qs == QuoteStyle::DynamicQuotes) + if (qs == QuoteStyle::Dynamic) continue; bool const langdef = (qs == def); if (langdef) { diff --git a/src/frontends/qt/Validator.cpp b/src/frontends/qt/Validator.cpp index 1f72d5625e..c0f5c27e57 100644 --- a/src/frontends/qt/Validator.cpp +++ b/src/frontends/qt/Validator.cpp @@ -234,7 +234,7 @@ QValidator::State PathValidator::validate(QString & qtext, int &) const void PathValidator::setChecker(KernelDocType const & type, LyXRC const & rc) { - latex_doc_ = type == KernelDocType::LATEX; + latex_doc_ = type == KernelDocType::LaTeX; tex_allows_spaces_ = rc.tex_allows_spaces; } diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index 7371ea68ff..63ddd43639 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -190,7 +190,7 @@ private: /// Called by the ForkedCall process that generated the bitmap files. void finishedGenerating(pid_t, int); /// - void dumpPreamble(otexstream &, FLAVOR) const; + void dumpPreamble(otexstream &, Flavor) const; /// void dumpData(odocstream &, BitmapFile const &) const; @@ -637,37 +637,37 @@ void PreviewLoader::Impl::startLoading(bool wait) && buffer_.params().default_output_format != "default"; // Use LATEX flavor if the document does not specify a specific // output format (see bug 9371). - FLAVOR flavor = docformat + Flavor flavor = docformat ? buffer_.params().getOutputFlavor() - : FLAVOR::LATEX; + : Flavor::LaTeX; if (buffer_.params().encoding().package() == Encoding::japanese) { latexparam = " --latex=platex"; - flavor = FLAVOR::LATEX; + flavor = Flavor::LaTeX; } else if (buffer_.params().useNonTeXFonts) { - if (flavor == FLAVOR::LUATEX) + if (flavor == Flavor::LuaTeX) latexparam = " --latex=lualatex"; else { - flavor = FLAVOR::XETEX; + flavor = Flavor::XeTeX; latexparam = " --latex=xelatex"; } } else { switch (flavor) { - case FLAVOR::PDFLATEX: + case Flavor::PdfLaTeX: latexparam = " --latex=pdflatex"; break; - case FLAVOR::XETEX: + case Flavor::XeTeX: latexparam = " --latex=xelatex"; break; - case FLAVOR::LUATEX: + case Flavor::LuaTeX: latexparam = " --latex=lualatex"; break; - case FLAVOR::DVILUATEX: + case Flavor::DviLuaTeX: latexparam = " --latex=dvilualatex"; break; default: - flavor = FLAVOR::LATEX; + flavor = Flavor::LaTeX; } } dumpPreamble(os, flavor); @@ -811,7 +811,7 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval) } -void PreviewLoader::Impl::dumpPreamble(otexstream & os, FLAVOR flavor) const +void PreviewLoader::Impl::dumpPreamble(otexstream & os, Flavor flavor) const { // Dump the preamble only. LYXERR(Debug::LATEX, "dumpPreamble, flavor == " << static_cast<int>(flavor)); diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index d0caa0f8d0..20ae1f2ac9 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -906,7 +906,7 @@ void InsetBibtex::validate(LaTeXFeatures & features) const // FIXME XHTML // It'd be better to be able to get this from an InsetLayout, but at present // InsetLayouts do not seem really to work for things that aren't InsetTexts. - if (features.runparams().flavor == FLAVOR::HTML) + if (features.runparams().flavor == Flavor::Html) features.addCSSSnippet("div.bibtexentry { margin-left: 2em; text-indent: -2em; }\n" "span.bibtexlabel:before{ content: \"[\"; }\n" "span.bibtexlabel:after{ content: \"] \"; }"); diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index 1915a5e084..7575702cfc 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -569,7 +569,7 @@ static docstring latexString(InsetExternal const & inset) // We don't need to set runparams.encoding since it is not used by // latex(). OutputParams runparams(0); - runparams.flavor = FLAVOR::LATEX; + runparams.flavor = Flavor::LaTeX; inset.latex(os, runparams); return ods.str(); } @@ -712,7 +712,7 @@ void InsetExternal::latex(otexstream & os, OutputParams const & runparams) const // If the template has specified a PDFLaTeX output, then we try and // use that. - if (runparams.flavor == FLAVOR::PDFLATEX) { + if (runparams.flavor == Flavor::PdfLaTeX) { external::Template const * const et_ptr = external::getTemplatePtr(params_); if (!et_ptr) @@ -815,25 +815,25 @@ void InsetExternal::validate(LaTeXFeatures & features) const string format; switch (features.runparams().flavor) { - case FLAVOR::LATEX: - case FLAVOR::DVILUATEX: + case Flavor::LaTeX: + case Flavor::DviLuaTeX: format = "LaTeX"; break; - case FLAVOR::LUATEX: - case FLAVOR::PDFLATEX: - case FLAVOR::XETEX: + case Flavor::LuaTeX: + case Flavor::PdfLaTeX: + case Flavor::XeTeX: format = "PDFLaTeX"; break; - case FLAVOR::DOCBOOK5: + case Flavor::DocBook5: format = "DocBook"; break; - case FLAVOR::HTML: + case Flavor::Html: format = "html"; break; - case FLAVOR::TEXT: + case Flavor::Text: format = "text"; break; - case FLAVOR::LYX: + case Flavor::LyX: format = "lyx"; break; } diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 433c6cca52..6341a6bf0b 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -111,9 +111,9 @@ namespace { string findTargetFormat(string const & format, OutputParams const & runparams) { // Are we latexing to DVI or PDF? - if (runparams.flavor == FLAVOR::PDFLATEX - || runparams.flavor == FLAVOR::XETEX - || runparams.flavor == FLAVOR::LUATEX) { + if (runparams.flavor == Flavor::PdfLaTeX + || runparams.flavor == Flavor::XeTeX + || runparams.flavor == Flavor::LuaTeX) { LYXERR(Debug::GRAPHICS, "findTargetFormat: PDF mode"); Format const * const f = theFormats().getFormat(format); // Convert vector graphics to pdf @@ -127,7 +127,7 @@ string findTargetFormat(string const & format, OutputParams const & runparams) } // for HTML and DocBook, we leave the known formats and otherwise convert to png - if (runparams.flavor == FLAVOR::HTML || runparams.flavor == FLAVOR::DOCBOOK5) { + if (runparams.flavor == Flavor::Html || runparams.flavor == Flavor::DocBook5) { Format const * const f = theFormats().getFormat(format); // Convert vector graphics to svg if (f && f->vectorFormat() && theConverters().isReachable(format, "svg")) @@ -696,7 +696,7 @@ string InsetGraphics::prepareFile(OutputParams const & runparams) const } // only show DVI-specific warning when export format is plain latex if (!isValidDVIFileName(output_file) - && runparams.flavor == FLAVOR::LATEX) { + && runparams.flavor == Flavor::LaTeX) { frontend::Alert::warning(_("Problematic filename for DVI"), _("The following filename can cause troubles " "when running the exported file through LaTeX " @@ -844,8 +844,8 @@ void InsetGraphics::latex(otexstream & os, string after; // Write the options if there are any. - bool const ps = runparams.flavor == FLAVOR::LATEX - || runparams.flavor == FLAVOR::DVILUATEX; + bool const ps = runparams.flavor == Flavor::LaTeX + || runparams.flavor == Flavor::DviLuaTeX; string const opts = createLatexOptions(ps); LYXERR(Debug::GRAPHICS, "\tOpts = " << opts); diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index a610c3c063..45c5a236d1 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -1290,7 +1290,7 @@ docstring latexString(InsetInclude const & inset) // We don't need to set runparams.encoding since this will be done // by latex() anyway. OutputParams runparams(nullptr); - runparams.flavor = FLAVOR::LATEX; + runparams.flavor = Flavor::LaTeX; runparams.for_preview = true; inset.latex(os, runparams); diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp index 90fed5757a..6108b838a6 100644 --- a/src/insets/InsetNote.cpp +++ b/src/insets/InsetNote.cpp @@ -296,7 +296,7 @@ void InsetNote::validate(LaTeXFeatures & features) const { switch (params_.type) { case InsetNoteParams::Comment: - if (features.runparams().flavor == FLAVOR::HTML) + if (features.runparams().flavor == Flavor::Html) // we do output this but set display to "none" by default, // but people might want to use it. InsetCollapsible::validate(features); diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index 332de763b8..5fe2939a7d 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -122,7 +122,7 @@ QuoteStyle InsetQuotesParams::getQuoteStyle(string const & s, if (i >= stylescount()) { LYXERR0("ERROR (InsetQuotes::InsetQuotes):" " bad style specification."); - res = QuoteStyle::EnglishQuotes; + res = QuoteStyle::English; } } @@ -154,7 +154,7 @@ QuoteSide InsetQuotesParams::getQuoteSide(string const & s, if (i >= 2) { LYXERR0("ERROR (InsetQuotes::InsetQuotes):" " bad side specification."); - res = QuoteSide::OpeningQuote; + res = QuoteSide::Opening; } } @@ -186,7 +186,7 @@ QuoteLevel InsetQuotesParams::getQuoteLevel(string const & s, if (i >= 2) { LYXERR0("ERROR (InsetQuotes::InsetQuotes):" " bad level specification."); - res = QuoteLevel::PrimaryQuotes; + res = QuoteLevel::Primary; } } @@ -207,105 +207,105 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c char_type right_secondary; switch (style) { - case QuoteStyle::EnglishQuotes: { + case QuoteStyle::English: { left_primary = 0x201c; // `` right_primary = 0x201d; // '' left_secondary = 0x2018; // ` right_secondary = 0x2019; // ' break; } - case QuoteStyle::SwedishQuotes: { + case QuoteStyle::Swedish: { left_primary = 0x201d; // '' right_primary = 0x201d; // '' left_secondary = 0x2019; // ' right_secondary = 0x2019; // ' break; } - case QuoteStyle::GermanQuotes: { + case QuoteStyle::German: { left_primary = 0x201e; // ,, right_primary = 0x201c; // `` left_secondary = 0x201a; // , right_secondary = 0x2018; // ` break; } - case QuoteStyle::PolishQuotes: { + case QuoteStyle::Polish: { left_primary = 0x201e; // ,, right_primary = 0x201d; // '' left_secondary = 0x201a; // , right_secondary = 0x2019; // ' break; } - case QuoteStyle::SwissQuotes: { + case QuoteStyle::Swiss: { left_primary = 0x00ab; // << right_primary = 0x00bb; // >> left_secondary = 0x2039; // < right_secondary = 0x203a; // > break; } - case QuoteStyle::DanishQuotes: { + case QuoteStyle::Danish: { left_primary = 0x00bb; // >> right_primary = 0x00ab; // << left_secondary = 0x203a; // > right_secondary = 0x2039; // < break; } - case QuoteStyle::PlainQuotes: { + case QuoteStyle::Plain: { left_primary = 0x0022; // " right_primary = 0x0022; // " left_secondary = 0x0027; // ' right_secondary = 0x0027; // ' break; } - case QuoteStyle::BritishQuotes: { + case QuoteStyle::British: { left_primary = 0x2018; // ` right_primary = 0x2019; // ' left_secondary = 0x201c; // `` right_secondary = 0x201d; // '' break; } - case QuoteStyle::SwedishGQuotes: { + case QuoteStyle::SwedishG: { left_primary = 0x00bb; // >> right_primary = 0x00bb; // >> left_secondary = 0x2019; // ' right_secondary = 0x2019; // ' break; } - case QuoteStyle::FrenchQuotes: { + case QuoteStyle::French: { left_primary = 0x00ab; // << right_primary = 0x00bb; // >> left_secondary = 0x201c; // `` right_secondary = 0x201d; // '' break; } - case QuoteStyle::FrenchINQuotes:{ + case QuoteStyle::FrenchIN:{ left_primary = 0x00ab; // << right_primary = 0x00bb; // >> left_secondary = 0x00ab; // << right_secondary = 0x00bb; // >> break; } - case QuoteStyle::RussianQuotes:{ + case QuoteStyle::Russian:{ left_primary = 0x00ab; // << right_primary = 0x00bb; // >> left_secondary = 0x201e; // ,, right_secondary = 0x201c; // `` break; } - case QuoteStyle::CJKQuotes:{ + case QuoteStyle::CJK:{ left_primary = 0x300c; // LEFT CORNER BRACKET right_primary = 0x300d; // RIGHT CORNER BRACKET left_secondary = 0x300e; // LEFT WHITE CORNER BRACKET right_secondary = 0x300f; // RIGHT WHITE CORNER BRACKET break; } - case QuoteStyle::CJKAngleQuotes:{ + case QuoteStyle::CJKAngle:{ left_primary = 0x300a; // LEFT DOUBLE ANGLE BRACKET right_primary = 0x300b; // RIGHT DOUBLE ANGLE BRACKET left_secondary = 0x3008; // LEFT ANGLE BRACKET right_secondary = 0x3009; // RIGHT ANGLE BRACKET break; } - case QuoteStyle::DynamicQuotes: + case QuoteStyle::Dynamic: default: // should not happen left_primary = 0x003f; // ? @@ -316,14 +316,14 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c } switch (level) { - case QuoteLevel::SecondaryQuotes: + case QuoteLevel::Secondary: if (rtl) - return (side == QuoteSide::ClosingQuote) ? left_secondary : right_secondary; - return (side == QuoteSide::OpeningQuote) ? left_secondary : right_secondary; - case QuoteLevel::PrimaryQuotes: + return (side == QuoteSide::Closing) ? left_secondary : right_secondary; + return (side == QuoteSide::Opening) ? left_secondary : right_secondary; + case QuoteLevel::Primary: if (rtl) - return (side == QuoteSide::ClosingQuote) ? left_primary : right_primary; - return (side == QuoteSide::OpeningQuote) ? left_primary : right_primary; + return (side == QuoteSide::Closing) ? left_primary : right_primary; + return (side == QuoteSide::Opening) ? left_primary : right_primary; default: break; } @@ -555,7 +555,7 @@ map<string, docstring> InsetQuotesParams::getTypes() const // get all quote types for (sty = 0; sty < stylescount(); ++sty) { style = QuoteStyle(sty); - if (style == QuoteStyle::DynamicQuotes) + if (style == QuoteStyle::Dynamic) continue; for (sid = 0; sid < 2; ++sid) { side = QuoteSide(sid); @@ -577,10 +577,10 @@ docstring const InsetQuotesParams::getGuiLabel(QuoteStyle const & qs, bool langd { docstring const styledesc = bformat(_("%1$souter%2$s and %3$sinner%4$s[[quotation marks]]"), - docstring(1, getQuoteChar(qs, QuoteLevel::PrimaryQuotes, QuoteSide::OpeningQuote)), - docstring(1, getQuoteChar(qs, QuoteLevel::PrimaryQuotes, QuoteSide::ClosingQuote)), - docstring(1, getQuoteChar(qs, QuoteLevel::SecondaryQuotes, QuoteSide::OpeningQuote)), - docstring(1, getQuoteChar(qs, QuoteLevel::SecondaryQuotes, QuoteSide::ClosingQuote)) + docstring(1, getQuoteChar(qs, QuoteLevel::Primary, QuoteSide::Opening)), + docstring(1, getQuoteChar(qs, QuoteLevel::Primary, QuoteSide::Closing)), + docstring(1, getQuoteChar(qs, QuoteLevel::Secondary, QuoteSide::Opening)), + docstring(1, getQuoteChar(qs, QuoteLevel::Secondary, QuoteSide::Closing)) ); if (!langdef) @@ -598,7 +598,7 @@ docstring const InsetQuotesParams::getShortGuiLabel(docstring const & str) const QuoteSide const side = getQuoteSide(s); QuoteLevel const level = getQuoteLevel(s); - return (side == QuoteSide::OpeningQuote) ? + return (side == QuoteSide::Opening) ? bformat(_("%1$stext"), docstring(1, getQuoteChar(style, level, side))) : bformat(_("text%1$s"), @@ -638,14 +638,14 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c, QuoteLevel level, fontenc_ = "OT1"; } if (style.empty()) - style_ = dynamic ? QuoteStyle::DynamicQuotes : global_style_; + style_ = dynamic ? QuoteStyle::Dynamic : global_style_; else style_ = getStyle(style); if (side == "left" || side == "opening") - side_ = QuoteSide::OpeningQuote; + side_ = QuoteSide::Opening; else if (side == "right" || side == "closing") - side_ = QuoteSide::ClosingQuote; + side_ = QuoteSide::Closing; else setSide(c); } @@ -661,9 +661,9 @@ void InsetQuotes::setSide(char_type c) { // Decide whether opening or closing quote if (lyx::isSpace(c) || isOpenPunctuation(c)) - side_ = QuoteSide::OpeningQuote;// opening quote + side_ = QuoteSide::Opening;// opening quote else - side_ = QuoteSide::ClosingQuote;// closing quote + side_ = QuoteSide::Closing;// closing quote } @@ -677,38 +677,38 @@ void InsetQuotes::parseString(string const & s, bool const allow_wildcards) QuoteStyle InsetQuotes::getStyle(string const & s) { - QuoteStyle qs = QuoteStyle::EnglishQuotes; + QuoteStyle qs = QuoteStyle::English; if (s == "english") - qs = QuoteStyle::EnglishQuotes; + qs = QuoteStyle::English; else if (s == "swedish") - qs = QuoteStyle::SwedishQuotes; + qs = QuoteStyle::Swedish; else if (s == "german") - qs = QuoteStyle::GermanQuotes; + qs = QuoteStyle::German; else if (s == "polish") - qs = QuoteStyle::PolishQuotes; + qs = QuoteStyle::Polish; else if (s == "swiss") - qs = QuoteStyle::SwissQuotes; + qs = QuoteStyle::Swiss; else if (s == "danish") - qs = QuoteStyle::DanishQuotes; + qs = QuoteStyle::Danish; else if (s == "plain") - qs = QuoteStyle::PlainQuotes; + qs = QuoteStyle::Plain; else if (s == "british") - qs = QuoteStyle::BritishQuotes; + qs = QuoteStyle::British; else if (s == "swedishg") - qs = QuoteStyle::SwedishGQuotes; + qs = QuoteStyle::SwedishG; else if (s == "french") - qs = QuoteStyle::FrenchQuotes; + qs = QuoteStyle::French; else if (s == "frenchin") - qs = QuoteStyle::FrenchINQuotes; + qs = QuoteStyle::FrenchIN; else if (s == "russian") - qs = QuoteStyle::RussianQuotes; + qs = QuoteStyle::Russian; else if (s == "cjk") - qs = QuoteStyle::CJKQuotes; + qs = QuoteStyle::CJK; else if (s == "cjkangle") - qs = QuoteStyle::CJKAngleQuotes; + qs = QuoteStyle::CJKAngle; else if (s == "dynamic") - qs = QuoteStyle::DynamicQuotes; + qs = QuoteStyle::Dynamic; return qs; } @@ -718,23 +718,23 @@ docstring InsetQuotes::displayString() const { // In PassThru, we use straight quotes if (pass_thru_) - return (level_ == QuoteLevel::PrimaryQuotes) ? + return (level_ == QuoteLevel::Primary) ? from_ascii("\"") : from_ascii("'"); QuoteStyle style = - (style_ == QuoteStyle::DynamicQuotes) ? global_style_ : style_; + (style_ == QuoteStyle::Dynamic) ? global_style_ : style_; docstring retdisp = docstring(1, quoteparams.getQuoteChar(style, level_, side_, rtl_)); // in French, thin spaces are added inside double guillemets if (prefixIs(context_lang_, "fr") - && level_ == QuoteLevel::PrimaryQuotes - && (style == QuoteStyle::SwissQuotes - || style == QuoteStyle::FrenchQuotes - || style == QuoteStyle::FrenchINQuotes)) { + && level_ == QuoteLevel::Primary + && (style == QuoteStyle::Swiss + || style == QuoteStyle::French + || style == QuoteStyle::FrenchIN)) { // THIN SPACE (U+2009) char_type const thin_space = 0x2009; - if (side_ == QuoteSide::OpeningQuote) + if (side_ == QuoteSide::Opening) retdisp += thin_space; else retdisp = thin_space + retdisp; @@ -757,7 +757,7 @@ void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const void InsetQuotes::draw(PainterInfo & pi, int x, int y) const { FontInfo font = pi.base.font; - if (style_ == QuoteStyle::DynamicQuotes) + if (style_ == QuoteStyle::Dynamic) font.setPaintColor(Color_special); else font.setPaintColor(pi.textColor(font.realColor())); @@ -839,17 +839,17 @@ bool InsetQuotes::getStatus(Cursor & cur, FuncRequest const & cmd, void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const { QuoteStyle style = - (style_ == QuoteStyle::DynamicQuotes) ? global_style_ : style_; + (style_ == QuoteStyle::Dynamic) ? global_style_ : style_; char_type quotechar = quoteparams.getQuoteChar(style, level_, side_, rtl_); docstring qstr; // In pass-thru context, we output plain quotes if (runparams.pass_thru) - qstr = (level_ == QuoteLevel::PrimaryQuotes) ? from_ascii("\"") : from_ascii("'"); - else if (style == QuoteStyle::PlainQuotes && fontspec_) { + qstr = (level_ == QuoteLevel::Primary) ? from_ascii("\"") : from_ascii("'"); + else if (style == QuoteStyle::Plain && fontspec_) { // For XeTeX and LuaTeX,we need to disable mapping to get straight // quotes. We define our own commands that do this - qstr = (level_ == QuoteLevel::PrimaryQuotes) ? + qstr = (level_ == QuoteLevel::Primary) ? from_ascii("\\textquotedblplain") : from_ascii("\\textquotesingleplain"); } else if (runparams.use_polyglossia) { @@ -859,21 +859,21 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const } // The CJK marks are not yet covered by utf8 inputenc (we don't have the entry in // unicodesymbols, since we don't want to add fake synbols there). - else if (style == QuoteStyle::CJKQuotes || style == QuoteStyle::CJKAngleQuotes) { + else if (style == QuoteStyle::CJK || style == QuoteStyle::CJKAngle) { if (runparams.encoding && runparams.encoding->name() != "utf8" && runparams.encoding->encodable(quotechar)) qstr = docstring(1, quotechar); else qstr = quoteparams.getLaTeXQuote(quotechar, "int"); } - else if ((style == QuoteStyle::SwissQuotes - || style == QuoteStyle::FrenchQuotes - || style == QuoteStyle::FrenchINQuotes) - && level_ == QuoteLevel::PrimaryQuotes + else if ((style == QuoteStyle::Swiss + || style == QuoteStyle::French + || style == QuoteStyle::FrenchIN) + && level_ == QuoteLevel::Primary && prefixIs(runparams.local_font->language()->code(), "fr")) { // Specific guillemets of French babel // including correct French spacing - if (side_ == QuoteSide::OpeningQuote) + if (side_ == QuoteSide::Opening) qstr = from_ascii("\\og"); else qstr = from_ascii("\\fg"); @@ -912,8 +912,8 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const // LuaTeX does not respect {} as ligature breaker by design, // see https://tex.stackexchange.com/q/349725/19291 docstring const nolig = - (runparams.flavor == FLAVOR::LUATEX - || runparams.flavor == FLAVOR::DVILUATEX) ? + (runparams.flavor == Flavor::LuaTeX + || runparams.flavor == Flavor::DviLuaTeX) ? from_ascii("\\/") : from_ascii("{}"); // !` ?` => !{}` ?{}` if (prefixIs(qstr, from_ascii("`")) @@ -945,19 +945,19 @@ int InsetQuotes::plaintext(odocstringstream & os, docstring InsetQuotes::getQuoteEntity(bool isHTML) const { QuoteStyle style = - (style_ == QuoteStyle::DynamicQuotes) ? global_style_ : style_; + (style_ == QuoteStyle::Dynamic) ? global_style_ : style_; docstring res = isHTML ? quoteparams.getHTMLQuote(quoteparams.getQuoteChar(style, level_, side_)) : quoteparams.getXMLQuote(quoteparams.getQuoteChar(style, level_, side_)); // in French, thin spaces are added inside double guillemets if (prefixIs(context_lang_, "fr") - && level_ == QuoteLevel::PrimaryQuotes - && (style == QuoteStyle::FrenchQuotes - || style == QuoteStyle::FrenchINQuotes - || style == QuoteStyle::SwissQuotes)) { + && level_ == QuoteLevel::Primary + && (style == QuoteStyle::French + || style == QuoteStyle::FrenchIN + || style == QuoteStyle::Swiss)) { // THIN SPACE (U+2009) docstring const thin_space = from_ascii(" "); - if (side_ == QuoteSide::OpeningQuote) // Open quote: space after + if (side_ == QuoteSide::Opening) // Open quote: space after res += thin_space; else // Close quote: space before res = thin_space + res; @@ -1008,7 +1008,7 @@ void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/, bo void InsetQuotes::validate(LaTeXFeatures & features) const { QuoteStyle style = - (style_ == QuoteStyle::DynamicQuotes) ? global_style_ : style_; + (style_ == QuoteStyle::Dynamic) ? global_style_ : style_; char_type type = quoteparams.getQuoteChar(style, level_, side_); // Handle characters that are not natively supported by diff --git a/src/insets/InsetQuotes.h b/src/insets/InsetQuotes.h index 2be62e71dc..14b3ba0007 100644 --- a/src/insets/InsetQuotes.h +++ b/src/insets/InsetQuotes.h @@ -23,51 +23,51 @@ namespace lyx { /// enum class QuoteStyle : int { /// - EnglishQuotes, + English, /// - SwedishQuotes, + Swedish, /// - GermanQuotes, + German, /// - PolishQuotes, + Polish, /// - SwissQuotes, + Swiss, /// - DanishQuotes, + Danish, /// - PlainQuotes, + Plain, /// - BritishQuotes, + British, /// - SwedishGQuotes, + SwedishG, /// - FrenchQuotes, + French, /// - FrenchINQuotes, + FrenchIN, /// - RussianQuotes, + Russian, /// - CJKQuotes, + CJK, /// - CJKAngleQuotes, + CJKAngle, /// - DynamicQuotes + Dynamic }; /// enum class QuoteSide : int { /// - OpeningQuote, + Opening, /// - ClosingQuote + Closing }; /// enum class QuoteLevel : int { /// - SecondaryQuotes, + Secondary, /// - PrimaryQuotes + Primary }; @@ -100,15 +100,15 @@ public: /// Returns the quote style from the shortcut string QuoteStyle getQuoteStyle(std::string const & s, bool const allow_wildcards = false, - QuoteStyle fallback = QuoteStyle::EnglishQuotes) const; + QuoteStyle fallback = QuoteStyle::English) const; /// Returns the quote sind from the shortcut string QuoteSide getQuoteSide(std::string const & s, bool const allow_wildcards = false, - QuoteSide fallback = QuoteSide::OpeningQuote) const; + QuoteSide fallback = QuoteSide::Opening) const; /// Returns the quote level from the shortcut string QuoteLevel getQuoteLevel(std::string const & s, bool const allow_wildcards = false, - QuoteLevel fallback = QuoteLevel::PrimaryQuotes) const; + QuoteLevel fallback = QuoteLevel::Primary) const; }; /// @@ -191,13 +191,13 @@ private: QuoteStyle getStyle(std::string const &); /// - QuoteStyle style_ = QuoteStyle::EnglishQuotes; + QuoteStyle style_ = QuoteStyle::English; /// - QuoteSide side_ = QuoteSide::OpeningQuote; + QuoteSide side_ = QuoteSide::Opening; /// - QuoteLevel level_ = QuoteLevel::PrimaryQuotes; + QuoteLevel level_ = QuoteLevel::Primary; /// - QuoteStyle global_style_ = QuoteStyle::EnglishQuotes; + QuoteStyle global_style_ = QuoteStyle::English; /// Current font encoding std::string fontenc_; /// Code of the contextual language diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 95dcf19674..1bd9497488 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -905,7 +905,7 @@ static docstring buffer_to_latex(Buffer & buffer) odocstringstream ods; otexstream os(ods); runparams.nice = true; - runparams.flavor = FLAVOR::XETEX; + runparams.flavor = Flavor::XeTeX; runparams.linelen = 10000; //lyxrc.plaintext_linelen; // No side effect of file copying and image conversion runparams.dryrun = true; @@ -928,7 +928,7 @@ static docstring stringifySearchBuffer(Buffer & buffer, FindAndReplaceOptions co // OutputParams runparams(&buffer.params().encoding()); OutputParams runparams(encodings.fromLyXName("utf8")); runparams.nice = true; - runparams.flavor = FLAVOR::XETEX; + runparams.flavor = Flavor::XeTeX; runparams.linelen = 10000; //lyxrc.plaintext_linelen; runparams.dryrun = true; runparams.for_search = true; @@ -3119,7 +3119,7 @@ docstring stringifyFromCursor(DocIterator const & cur, int len) // OutputParams runparams(&cur.buffer()->params().encoding()); OutputParams runparams(encodings.fromLyXName("utf8")); runparams.nice = true; - runparams.flavor = FLAVOR::XETEX; + runparams.flavor = Flavor::XeTeX; runparams.linelen = 10000; //lyxrc.plaintext_linelen; // No side effect of file copying and image conversion runparams.dryrun = true; @@ -3165,7 +3165,7 @@ docstring latexifyFromCursor(DocIterator const & cur, int len) //OutputParams runparams(&buf.params().encoding()); OutputParams runparams(encodings.fromLyXName("utf8")); runparams.nice = false; - runparams.flavor = FLAVOR::XETEX; + runparams.flavor = Flavor::XeTeX; runparams.linelen = 8000; //lyxrc.plaintext_linelen; // No side effect of file copying and image conversion runparams.dryrun = true; @@ -3641,7 +3641,7 @@ static int findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, Ma // OutputParams runparams(&repl_buffer.params().encoding()); OutputParams runparams(encodings.fromLyXName("utf8")); runparams.nice = false; - runparams.flavor = FLAVOR::XETEX; + runparams.flavor = Flavor::XeTeX; runparams.linelen = 8000; //lyxrc.plaintext_linelen; runparams.dryrun = true; TeXOnePar(repl_buffer, repl_buffer.text(), 0, os, runparams); -- 2.28.0.windows.1
-- lyx-devel mailing list lyx-devel@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-devel