Implement dynamic quotation marks

File format change.
This commit is contained in:
Juergen Spitzmueller 2016-12-25 12:19:02 +01:00
parent 3e7665f2c6
commit 36a679344a
12 changed files with 287 additions and 123 deletions

View File

@ -11,6 +11,11 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
-----------------------
2016-12-25 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 522: Implement dynamic quotation marks.
\begin_inset Quotes x..
New buffer param \dynamic_quotation true|false
2016-12-24 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 521:
Introduce new quote styles:

View File

@ -2534,7 +2534,7 @@ inset-modify changetype Ovalbox
\begin_inset Newline newline
\end_inset
Change a quotation mark to e[nglish style], l[eft side], s[ingle]
Change a quotation mark to e[nglish style], l[eft side = opening], s[ingle = inner, secondary]
\begin_inset Newline newline
\end_inset
@ -3454,7 +3454,7 @@ Syntax quote-insert [<LEVEL>] [<SIDE>] [<STYLE>]
\end_layout
\begin_layout Description
Params <LEVEL>: 'single' for single (i.e., inner or secondary) quotes, otherwise double quotes will be used. <SIDE>: 'left' for opening quotes, 'right' for closing quotes, otherwise the side will be guessed from the context. <STYLE>: 'english' for ``English'' quote style 'swedish' for ''Swedish'' quote style 'german' for ,,German`` quote style 'polish' for ,,Polish'' quote style 'french' for <<French>> quote style 'danish' for >>Danish<< quote style If no quote style is specified, the document-wide will be used.
Params <LEVEL>: 'inner' for (i.e., secondary, usually single) quotes, otherwise outer (i.e., primary, usually double) quotes will be used. <SIDE>: 'opening' for opening quotes, 'closing' for closing quotes, otherwise the side will be guessed from the context. <STYLE>: 'british' for `British' quote style (with ``inner quotation'') 'danish' for >>Danish<< quote style (with >inner quotation<) 'english' for ``English'' quote style (with `inner quotation') 'french' for <<french>> quote style (with ``inner quotation'') 'frenchin' for <<frenchin>> quote style (with <<inner quotation>>) ["in" = Imprimerie Nationale] 'german' for ,,German`` quote style (with ,inner quotation`) 'plain' for "Plain" quote style (with 'inner quotation') 'polish' for ,,Polish'' quote style (with ,inner quotation') 'swedish' for ''Swedish'' quote style (with 'inner quotation') 'swedishg' for >>swedishg>> quote style (with 'inner quotation') ["g" = Guillemets] 'swiss' for <<Swiss>> quote style (with <inner quotation>) 'russian' for <<Russian>> quote style (with ,,inner quotation``) 'dynamic' for Dynamic quotation marks which inherit the global document style If no quote style is specified, the document-wide will be used.
\end_layout
\begin_layout Subsection*

View File

@ -849,6 +849,58 @@ def revert_russianquotes(document):
i += 1
def revert_dynamicquotes(document):
" Revert dynamic quote insets "
# First, revert header
i = find_token(document.header, "\\dynamic_quotes", 0)
if i != -1:
del document.header[i]
# Get global style
style = "english"
i = find_token(document.header, "\\quotes_style", 0)
if i == -1:
document.warning("Malformed document! Missing \\quotes_style")
else:
style = get_value(document.header, "\\quotes_style", i)
s = ""
if style == "english":
s = "e"
elif style == "swedish":
s = "s"
elif style == "german":
s = "g"
elif style == "polish":
s = "p"
elif style == "swiss":
s = "c"
elif style == "danish":
s = "a"
elif style == "plain":
s = "q"
elif style == "british":
s = "b"
elif style == "swedishg":
s = "w"
elif style == "french":
s = "f"
elif style == "frenchin":
s = "i"
elif style == "russian":
s = "r"
# now transform the insets
i = 0
while True:
i = find_token(document.body, '\\begin_inset Quotes x', i)
if i == -1:
return
document.body[i] = document.body[i].replace("x", s)
i += 1
##
# Conversion hub
#
@ -867,10 +919,12 @@ convert = [
[518, [convert_iopart]],
[519, [convert_quotestyle]],
[520, []],
[521, [convert_frenchquotes]]
[521, [convert_frenchquotes]],
[522, []]
]
revert = [
[521, [revert_dynamicquotes]],
[520, [revert_britishquotes, revert_swedishgquotes, revert_frenchquotes, revert_frenchinquotes, revert_russianquotes, revert_swissquotes]],
[519, [revert_plainquote]],
[518, [revert_quotestyle]],

View File

@ -402,6 +402,7 @@ BufferParams::BufferParams()
makeDocumentClass();
paragraph_separation = ParagraphIndentSeparation;
quotes_style = InsetQuotesParams::EnglishQuotes;
dynamic_quotes = false;
fontsize = "default";
/* PaperLayout */
@ -839,6 +840,8 @@ string BufferParams::readToken(Lexer & lex, string const & token,
string qstyle;
lex >> qstyle;
quotes_style = quotesstyletranslator().find(qstyle);
} else if (token == "\\dynamic_quotes") {
lex >> dynamic_quotes;
} else if (token == "\\papersize") {
string ppsize;
lex >> ppsize;
@ -1308,6 +1311,7 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
os << "\n\\defskip " << getDefSkip().asLyXCommand();
os << "\n\\quotes_style "
<< string_quotes_style[quotes_style]
<< "\n\\dynamic_quotes " << dynamic_quotes
<< "\n\\papercolumns " << columns
<< "\n\\papersides " << sides
<< "\n\\paperpagestyle " << pagestyle << '\n';

View File

@ -108,6 +108,8 @@ public:
///
InsetQuotesParams::QuoteStyle quotes_style;
///
bool dynamic_quotes;
///
std::string fontsize;
/// Get the LayoutFile this document is using.
LayoutFile const * baseClass() const;

View File

@ -420,6 +420,8 @@ void LyXAction::init()
* 'swedishg' for >>swedishg>> quote style (with 'inner quotation') ["g" = Guillemets]
* 'swiss' for <<Swiss>> quote style (with <inner quotation>)
* 'russian' for <<Russian>> quote style (with ,,inner quotation``)
* 'dynamic' for Dynamic quotation marks which inherit the global
* document style
* If no quote style is specified, the document-wide will be used.
* \endvar
*/

View File

@ -1046,6 +1046,8 @@ GuiDocument::GuiDocument(GuiView & lv)
this, SLOT(change_adaptor()));
connect(langModule->languagePackageCO, SIGNAL(currentIndexChanged(int)),
this, SLOT(languagePackageChanged(int)));
connect(langModule->dynamicQuotesCB, SIGNAL(clicked()),
this, SLOT(change_adaptor()));
langModule->languagePackageLE->setValidator(new NoNewLineValidator(
langModule->languagePackageLE));
@ -2652,6 +2654,7 @@ void GuiDocument::applyView()
bp_.quotes_style = (InsetQuotesParams::QuoteStyle) langModule->quoteStyleCO->itemData(
langModule->quoteStyleCO->currentIndex()).toInt();
bp_.dynamic_quotes = langModule->dynamicQuotesCB->isChecked();
QString const langname = langModule->languageCO->itemData(
langModule->languageCO->currentIndex()).toString();
@ -3064,6 +3067,7 @@ void GuiDocument::paramsToDialog()
langModule->quoteStyleCO->setCurrentIndex(
bp_.quotes_style);
langModule->dynamicQuotesCB->setChecked(bp_.dynamic_quotes);
bool default_enc = true;
if (bp_.inputenc != "auto") {

View File

@ -1687,10 +1687,41 @@ void MenuDefinition::expandQuotes(BufferView const * bv)
MenuDefinition fqs;
MenuDefinition iqs;
MenuDefinition rqs;
MenuDefinition xqs;
InsetQuotesParams::QuoteStyle globalqs = bv->buffer().params().quotes_style;
FuncRequest cmd = FuncRequest(LFUN_INSET_MODIFY, from_ascii("changetype xld"));
docstring desc = bformat(_("%1$stext (dynamic)"), docstring(1, quoteparams.getQuoteChar(globalqs, InsetQuotesParams::PrimaryQuotes,
InsetQuotesParams::OpeningQuote)));
if (prefixIs(qtype, "x"))
add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
else
xqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
cmd = FuncRequest(LFUN_INSET_MODIFY, from_ascii("changetype xls"));
desc = bformat(_("%1$stext (dynamic)"), docstring(1, quoteparams.getQuoteChar(globalqs, InsetQuotesParams::SecondaryQuotes,
InsetQuotesParams::OpeningQuote)));
if (prefixIs(qtype, "x"))
add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
else
xqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
cmd = FuncRequest(LFUN_INSET_MODIFY, from_ascii("changetype xrd"));
desc = bformat(_("text%1$s (dynamic)"), docstring(1, quoteparams.getQuoteChar(globalqs, InsetQuotesParams::PrimaryQuotes,
InsetQuotesParams::ClosingQuote)));
if (prefixIs(qtype, "x"))
add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
else
xqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
cmd = FuncRequest(LFUN_INSET_MODIFY, from_ascii("changetype xrs"));
desc = bformat(_("text%1$s (dynamic)"), docstring(1, quoteparams.getQuoteChar(globalqs, InsetQuotesParams::SecondaryQuotes,
InsetQuotesParams::ClosingQuote)));
if (prefixIs(qtype, "x"))
add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
else
xqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
for (; qq != end; ++qq) {
docstring const style = from_ascii(qq->first);
FuncRequest const cmd = FuncRequest(LFUN_INSET_MODIFY, from_ascii("changetype ") + style);
docstring const desc = contains(style, 'l') ?
cmd = FuncRequest(LFUN_INSET_MODIFY, from_ascii("changetype ") + style);
desc = contains(style, 'l') ?
bformat(_("%1$stext"), qq->second) : bformat(_("text%1$s"), qq->second);
if (prefixIs(style, qtype[0]))
add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
@ -1720,6 +1751,11 @@ void MenuDefinition::expandQuotes(BufferView const * bv)
rqs.add(MenuItem(MenuItem::Command, toqstr(desc), cmd));
}
if (!xqs.empty()) {
MenuItem item(MenuItem::Submenu, qt_("Dynamic Quotation Marks"));
item.setSubmenu(xqs);
add(item);
}
if (!eqs.empty()) {
MenuItem item(MenuItem::Submenu,
toqstr(quoteparams.getGuiLabel(InsetQuotesParams::EnglishQuotes)));

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>335</width>
<width>431</width>
<height>282</height>
</rect>
</property>
@ -14,22 +14,34 @@
<string/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="languageL">
<property name="text">
<string>&amp;Language:</string>
<item row="5" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="buddy">
<cstring>languageCO</cstring>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>71</width>
<height>171</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="languageCO">
<property name="maxVisibleItems">
<number>20</number>
<item row="4" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<property name="sizeHint" stdset="0">
<size>
<width>38</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer>
@ -47,6 +59,13 @@
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="languageCO">
<property name="maxVisibleItems">
<number>20</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="typeL">
<property name="text">
@ -57,73 +76,12 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="quoteStyleCO"/>
</item>
<item row="2" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Encoding</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<property name="margin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="defaultencodingRB">
<property name="text">
<string>Language &amp;default</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>81</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="otherencodingRB">
<property name="text">
<string>&amp;Other:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="encodingCO">
<property name="enabled">
<bool>false</bool>
</property>
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" colspan="3">
<item row="4" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="languagePackageLA">
<property name="text">
<string>Language pac&amp;kage:</string>
<string>Language pa&amp;ckage:</string>
</property>
<property name="buddy">
<cstring>languagePackageCO</cstring>
@ -146,34 +104,95 @@
</item>
</layout>
</item>
<item row="3" column="3">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>38</width>
<height>20</height>
</size>
</property>
</spacer>
<item row="1" column="1">
<widget class="QComboBox" name="quoteStyleCO"/>
</item>
<item row="4" column="1">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
<item row="0" column="0">
<widget class="QLabel" name="languageL">
<property name="text">
<string>&amp;Language:</string>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
<property name="buddy">
<cstring>languageCO</cstring>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>71</width>
<height>171</height>
</size>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Encoding</string>
</property>
</spacer>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QGridLayout">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<property name="rightMargin">
<number>9</number>
</property>
<property name="bottomMargin">
<number>9</number>
</property>
<property name="spacing">
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="defaultencodingRB">
<property name="text">
<string>Lan&amp;guage default</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>81</width>
<height>22</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QRadioButton" name="otherencodingRB">
<property name="text">
<string>Othe&amp;r:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="encodingCO">
<property name="enabled">
<bool>false</bool>
</property>
<property name="duplicatesEnabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="2" column="1">
<widget class="QCheckBox" name="dynamicQuotesCB">
<property name="toolTip">
<string>Output quotation marks that automatically adapt to the style selected above. If this is not selected, the quotation marks will stick with the style they have been inserted with.</string>
</property>
<property name="text">
<string>Use d&amp;ynamic quotation marks</string>
</property>
</widget>
</item>
</layout>
</widget>

View File

@ -64,9 +64,10 @@ namespace {
* f <<french>> (``inner quotation'')
* i <<frenchin>> (<<inner quotation>>) ["in" = Imprimerie Nationale]
* r <<russian>> (,,inner quotation``)
* x dynamic style (inherits document settings)
*/
char const * const style_char = "esgpcaqbwfir";
char const * const style_char = "esgpcaqbwfirx";
char const * const side_char = "lr" ;
char const * const level_char = "sd";
@ -185,6 +186,7 @@ char_type InsetQuotesParams::getQuoteChar(QuoteStyle const & style, QuoteLevel c
right_secondary = 0x201c; // ``
break;
}
case DynamicQuotes:
default:
// should not happen
left_primary = 0x003f; // ?
@ -367,6 +369,8 @@ map<string, docstring> InsetQuotesParams::getTypes() const
// get all quote types
for (sty = 0; sty < stylescount(); ++sty) {
style = QuoteStyle(sty);
if (style == DynamicQuotes)
continue;
for (sid = 0; sid < 2; ++sid) {
side = QuoteSide(sid);
for (lev = 0; lev < 2; ++lev) {
@ -402,6 +406,11 @@ docstring const InsetQuotesParams::getGuiLabel(QuoteStyle const & qs)
InsetQuotes::InsetQuotes(Buffer * buf, string const & str) : Inset(buf)
{
if (buf)
global_style_ = buf->masterBuffer()->params().quotes_style;
else
global_style_ = InsetQuotesParams::EnglishQuotes;
parseString(str);
}
@ -410,14 +419,20 @@ InsetQuotes::InsetQuotes(Buffer * buf, char_type c, InsetQuotesParams::QuoteLeve
string const & side, string const & style)
: Inset(buf), level_(level), pass_thru_(false)
{
bool dynamic = false;
if (buf) {
style_ = style.empty() ? buf->params().quotes_style : getStyle(style);
fontenc_ = (buf->params().fontenc == "global")
global_style_ = buf->masterBuffer()->params().quotes_style;
fontenc_ = (buf->masterBuffer()->params().fontenc == "global")
? lyxrc.fontenc : buf->params().fontenc;
dynamic = buf->masterBuffer()->params().dynamic_quotes;
} else {
style_ = style.empty() ? InsetQuotesParams::EnglishQuotes : getStyle(style);
global_style_ = InsetQuotesParams::EnglishQuotes;
fontenc_ = lyxrc.fontenc;
}
if (style.empty())
style_ = dynamic ? InsetQuotesParams::DynamicQuotes : global_style_;
else
style_ = getStyle(style);
if (side == "left" || side == "opening")
side_ = InsetQuotesParams::OpeningQuote;
@ -533,6 +548,8 @@ InsetQuotesParams::QuoteStyle InsetQuotes::getStyle(string const & s)
qs = InsetQuotesParams::FrenchQuotes;
else if (s == "frenchin")
qs = InsetQuotesParams::FrenchINQuotes;
else if (s == "dynamic")
qs = InsetQuotesParams::DynamicQuotes;
return qs;
}
@ -545,14 +562,17 @@ docstring InsetQuotes::displayString() const
return (level_ == InsetQuotesParams::PrimaryQuotes) ?
from_ascii("\"") : from_ascii("'");
docstring retdisp = docstring(1, quoteparams.getQuoteChar(style_, level_, side_));
InsetQuotesParams::QuoteStyle style =
(style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
docstring retdisp = docstring(1, quoteparams.getQuoteChar(style, level_, side_));
// 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)) {
&& (style == InsetQuotesParams::SwissQuotes
|| style == InsetQuotesParams::FrenchQuotes
|| style == InsetQuotesParams::FrenchINQuotes)) {
// THIN SPACE (U+2009)
char_type const thin_space = 0x2009;
if (side_ == InsetQuotesParams::OpeningQuote)
@ -578,7 +598,10 @@ void InsetQuotes::metrics(MetricsInfo & mi, Dimension & dim) const
void InsetQuotes::draw(PainterInfo & pi, int x, int y) const
{
FontInfo font = pi.base.font;
font.setPaintColor(pi.textColor(font.realColor()));
if (style_ == InsetQuotesParams::DynamicQuotes)
font.setPaintColor(Color_special);
else
font.setPaintColor(pi.textColor(font.realColor()));
pi.pain.text(x, y, displayString(), font);
}
@ -656,13 +679,15 @@ bool InsetQuotes::getStatus(Cursor & cur, FuncRequest const & cmd,
void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
{
char_type quotechar = quoteparams.getQuoteChar(style_, level_, side_);
InsetQuotesParams::QuoteStyle style =
(style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
char_type quotechar = quoteparams.getQuoteChar(style, level_, side_);
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 && runparams.isFullUnicode()) {
else if (style == InsetQuotesParams::PlainQuotes && runparams.isFullUnicode()) {
// 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) ?
@ -673,7 +698,9 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const
// (spacing and kerning is then handled respectively)
qstr = docstring(1, quotechar);
}
else if (style_ == InsetQuotesParams::FrenchQuotes
else if ((style == InsetQuotesParams::SwissQuotes
|| style == InsetQuotesParams::FrenchQuotes
|| style == InsetQuotesParams::FrenchINQuotes)
&& level_ == InsetQuotesParams::PrimaryQuotes
&& prefixIs(runparams.local_font->language()->code(), "fr")) {
// Specific guillemets of French babel
@ -737,11 +764,15 @@ int InsetQuotes::plaintext(odocstringstream & os,
docstring InsetQuotes::getQuoteEntity() const {
docstring res = quoteparams.getHTMLQuote(quoteparams.getQuoteChar(style_, level_, side_));
InsetQuotesParams::QuoteStyle style =
(style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
docstring res = quoteparams.getHTMLQuote(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::FrenchQuotes
|| style == InsetQuotesParams::FrenchINQuotes
|| style == InsetQuotesParams::SwissQuotes)) {
// THIN SPACE (U+2009)
docstring const thin_space = from_ascii("&#x2009;");
if (side_ == InsetQuotesParams::OpeningQuote)
@ -785,12 +816,15 @@ void InsetQuotes::updateBuffer(ParIterator const & it, UpdateType /* utype*/)
pass_thru_ = it.paragraph().isPassThru();
context_lang_ = it.paragraph().getFontSettings(bp, it.pos()).language()->code();
fontenc_ = (bp.fontenc == "global") ? lyxrc.fontenc : bp.fontenc;
global_style_ = bp.quotes_style;
}
void InsetQuotes::validate(LaTeXFeatures & features) const
{
char_type type = quoteparams.getQuoteChar(style_, level_, side_);
InsetQuotesParams::QuoteStyle style =
(style_ == InsetQuotesParams::DynamicQuotes) ? global_style_ : style_;
char_type type = quoteparams.getQuoteChar(style, level_, side_);
// Handle characters that are not natively supported by
// specific font encodings (we roll our own definitions)

View File

@ -50,7 +50,9 @@ public:
///
FrenchINQuotes,
///
RussianQuotes
RussianQuotes,
///
DynamicQuotes
};
///
enum QuoteSide {
@ -167,6 +169,8 @@ private:
///
InsetQuotesParams::QuoteLevel level_;
///
InsetQuotesParams::QuoteStyle global_style_;
///
std::string fontenc_;
/// Code of the contextual language
std::string context_lang_;

View File

@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
// Do not remove the comment below, so we get merge conflict in
// independent branches. Instead add your own.
#define LYX_FORMAT_LYX 521 // spitz: new quotes styles
#define LYX_FORMAT_TEX2LYX 521
#define LYX_FORMAT_LYX 522 // spitz: dynamic quotes styles
#define LYX_FORMAT_TEX2LYX 522
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
#ifndef _MSC_VER