Better naming for enums

This commit is contained in:
Yuriy Skalko 2020-12-01 00:00:40 +02:00
parent 890ca6df7b
commit c0a5987181
26 changed files with 275 additions and 275 deletions

View File

@ -2321,7 +2321,7 @@ int Buffer::runChktex()
// Generate the LaTeX file if neccessary
OutputParams runparams(&params().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;

View File

@ -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)

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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);
} */

View File

@ -24,7 +24,7 @@ namespace support { class FileName; }
class Buffer;
enum class FLAVOR : int;
enum class Flavor : int;
class Format {
public:
@ -220,9 +220,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.

View File

@ -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

View File

@ -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

View File

@ -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?

View File

@ -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";
}
}

View File

@ -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);

View File

@ -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();

View File

@ -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;
}

View File

@ -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

View File

@ -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) {

View File

@ -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;
}

View File

@ -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));

View File

@ -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: \"] \"; }");

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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("&#x2009;");
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

View File

@ -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

View File

@ -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);