Simplify InsetQuotes constructors

This commit is contained in:
Yuriy Skalko 2020-11-24 22:42:06 +02:00
parent fe0ea7bff7
commit 8e60182f58
2 changed files with 10 additions and 19 deletions

View File

@ -614,18 +614,12 @@ docstring const InsetQuotesParams::getShortGuiLabel(docstring const & str) const
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
InsetQuotes::InsetQuotes(Buffer * buf, string const & str) InsetQuotes::InsetQuotes(Buffer * buf, string const & str)
: Inset(buf), : Inset(buf)
style_(InsetQuotesParams::EnglishQuotes), side_(InsetQuotesParams::OpeningQuote),
pass_thru_(false), internal_fontenc_(false), rtl_(false)
{ {
if (buf) { if (buf) {
global_style_ = buf->masterBuffer()->params().quotes_style; global_style_ = buf->masterBuffer()->params().quotes_style;
fontspec_ = buf->masterBuffer()->params().useNonTeXFonts; fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
} }
else {
global_style_ = InsetQuotesParams::EnglishQuotes;
fontspec_ = false;
}
parseString(str); parseString(str);
} }
@ -633,8 +627,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, InsetQuotesParams::QuoteLevel level,
string const & side, string const & style) string const & side, string const & style)
: Inset(buf), level_(level), pass_thru_(false), fontspec_(false), : Inset(buf), level_(level)
internal_fontenc_(false), rtl_(false)
{ {
bool dynamic = false; bool dynamic = false;
if (buf) { if (buf) {
@ -643,9 +636,7 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLeve
dynamic = buf->masterBuffer()->params().dynamic_quotes; dynamic = buf->masterBuffer()->params().dynamic_quotes;
fontspec_ = buf->masterBuffer()->params().useNonTeXFonts; fontspec_ = buf->masterBuffer()->params().useNonTeXFonts;
} else { } else {
global_style_ = InsetQuotesParams::EnglishQuotes;
fontenc_ = "OT1"; fontenc_ = "OT1";
fontspec_ = false;
} }
if (style.empty()) if (style.empty())
style_ = dynamic ? InsetQuotesParams::DynamicQuotes : global_style_; style_ = dynamic ? InsetQuotesParams::DynamicQuotes : global_style_;

View File

@ -187,25 +187,25 @@ private:
InsetQuotesParams::QuoteStyle getStyle(std::string const &); InsetQuotesParams::QuoteStyle getStyle(std::string const &);
/// ///
InsetQuotesParams::QuoteStyle style_; InsetQuotesParams::QuoteStyle style_ = InsetQuotesParams::EnglishQuotes;
/// ///
InsetQuotesParams::QuoteSide side_; InsetQuotesParams::QuoteSide side_ = InsetQuotesParams::OpeningQuote;
/// ///
InsetQuotesParams::QuoteLevel level_; InsetQuotesParams::QuoteLevel level_ = InsetQuotesParams::PrimaryQuotes;
/// ///
InsetQuotesParams::QuoteStyle global_style_; InsetQuotesParams::QuoteStyle global_style_ = InsetQuotesParams::EnglishQuotes;
/// Current font encoding /// Current font encoding
std::string fontenc_; std::string fontenc_;
/// Code of the contextual language /// Code of the contextual language
std::string context_lang_; std::string context_lang_;
/// Is this in a pass-thru context? /// Is this in a pass-thru context?
bool pass_thru_; bool pass_thru_ = false;
/// Do we use fontspec? /// Do we use fontspec?
bool fontspec_; bool fontspec_ = false;
/// Do we have an internal font encoding? /// Do we have an internal font encoding?
bool internal_fontenc_; bool internal_fontenc_ = false;
/// Are we writing RTL? /// Are we writing RTL?
bool rtl_; bool rtl_ = false;
/// ///
friend class InsetQuotesParams; friend class InsetQuotesParams;