mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
* UI changes in anticipation of polyglossia support:
- rename \language_package to \language_custom_package - the bool \language_use_babel is replaced by a more fine-grained selection: * chose language package automatically (later: babel or polyglossia) * always use babel (also with XeTeX) * custom (i.e. use \language_custom_package) * none (equivalent to former \language_use_babel false) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36407 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
1095d89442
commit
ef79a1fe8a
@ -19,7 +19,19 @@ be more eventually.
|
||||
|
||||
Bash completion script was added to the tarball.
|
||||
|
||||
The following variables are obsoleted in 2.0
|
||||
The following pref variables were changed in 2.0:
|
||||
|
||||
- \language_package was renamed to \language_custom_package
|
||||
|
||||
- \language_use_babel (bool) has been replaced by
|
||||
\language_package_selection, which can be
|
||||
0 (automatic selection)
|
||||
1 (always use babel)
|
||||
2 custom (use the custom package defined by
|
||||
\language_custom_package)
|
||||
3 none (equivalent to former \language_use_babel false)
|
||||
|
||||
The following pref variables are obsoleted in 2.0:
|
||||
|
||||
- \plaintext_roff_command (was not used anymore)
|
||||
|
||||
|
@ -2394,9 +2394,8 @@ string const BufferParams::font_encoding() const
|
||||
|
||||
string BufferParams::babelCall(string const & lang_opts, bool const langoptions) const
|
||||
{
|
||||
string lang_pack = lyxrc.language_package;
|
||||
if (lang_pack != "\\usepackage{babel}")
|
||||
return lang_pack;
|
||||
if (lyxrc.language_package_selection == LyXRC::LP_CUSTOM)
|
||||
return lyxrc.language_custom_package;
|
||||
// suppress the babel call if there is no BabelName defined
|
||||
// for the document language in the lib/languages file and if no
|
||||
// other languages are used (lang_opts is then empty)
|
||||
@ -2407,7 +2406,7 @@ string BufferParams::babelCall(string const & lang_opts, bool const langoptions)
|
||||
// be submitted to babel itself (not the class).
|
||||
if (langoptions)
|
||||
return "\\usepackage[" + lang_opts + "]{babel}";
|
||||
return lang_pack;
|
||||
return "\\usepackage{babel}";
|
||||
}
|
||||
|
||||
|
||||
|
@ -285,10 +285,10 @@ LaTeXFeatures::LaTeXFeatures(Buffer const & b, BufferParams const & p,
|
||||
|
||||
bool LaTeXFeatures::useBabel() const
|
||||
{
|
||||
return lyxrc.language_use_babel ||
|
||||
(bufferParams().language->lang() != lyxrc.default_language &&
|
||||
return (lyxrc.language_package_selection != LyXRC::LP_NONE) &&
|
||||
((bufferParams().language->lang() != lyxrc.default_language &&
|
||||
!bufferParams().language->babel().empty()) ||
|
||||
this->hasLanguages();
|
||||
this->hasLanguages());
|
||||
}
|
||||
|
||||
|
||||
|
@ -122,9 +122,9 @@ LexerKeyword lyxrcTags[] = {
|
||||
{ "\\language_command_begin", LyXRC::RC_LANGUAGE_COMMAND_BEGIN },
|
||||
{ "\\language_command_end", LyXRC::RC_LANGUAGE_COMMAND_END },
|
||||
{ "\\language_command_local", LyXRC::RC_LANGUAGE_COMMAND_LOCAL },
|
||||
{ "\\language_custom_package", LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE },
|
||||
{ "\\language_global_options", LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS },
|
||||
{ "\\language_package", LyXRC::RC_LANGUAGE_PACKAGE },
|
||||
{ "\\language_use_babel", LyXRC::RC_LANGUAGE_USE_BABEL },
|
||||
{ "\\language_package_selection", LyXRC::RC_LANGUAGE_PACKAGE_SELECTION },
|
||||
{ "\\load_session", LyXRC::RC_LOADSESSION },
|
||||
{ "\\mac_dontswap_ctrl_meta", LyXRC::RC_MAC_DONTSWAP_CTRL_META },
|
||||
{ "\\mac_like_word_movement", LyXRC::RC_MAC_LIKE_WORD_MOVEMENT },
|
||||
@ -310,8 +310,8 @@ void LyXRC::setDefaults()
|
||||
language_auto_begin = true;
|
||||
language_auto_end = true;
|
||||
language_global_options = true;
|
||||
language_use_babel = true;
|
||||
language_package = "\\usepackage{babel}";
|
||||
language_package_selection = LP_AUTO;
|
||||
language_custom_package = "\\usepackage{babel}";
|
||||
language_command_begin = "\\selectlanguage{$$lang}";
|
||||
language_command_local = "\\foreignlanguage{$$lang}{";
|
||||
sort_layouts = false;
|
||||
@ -966,8 +966,8 @@ int LyXRC::read(Lexer & lexrc)
|
||||
case RC_DATE_INSERT_FORMAT:
|
||||
lexrc >> date_insert_format;
|
||||
break;
|
||||
case RC_LANGUAGE_PACKAGE:
|
||||
lexrc >> language_package;
|
||||
case RC_LANGUAGE_CUSTOM_PACKAGE:
|
||||
lexrc >> language_custom_package;
|
||||
break;
|
||||
case RC_LANGUAGE_AUTO_BEGIN:
|
||||
lexrc >> language_auto_begin;
|
||||
@ -978,8 +978,23 @@ int LyXRC::read(Lexer & lexrc)
|
||||
case RC_LANGUAGE_GLOBAL_OPTIONS:
|
||||
lexrc >> language_global_options;
|
||||
break;
|
||||
case RC_LANGUAGE_USE_BABEL:
|
||||
lexrc >> language_use_babel;
|
||||
case RC_LANGUAGE_PACKAGE_SELECTION:
|
||||
if (lexrc.next()) {
|
||||
switch (lexrc.getInteger()) {
|
||||
case 0:
|
||||
language_package_selection = LP_AUTO;
|
||||
break;
|
||||
case 1:
|
||||
language_package_selection = LP_BABEL;
|
||||
break;
|
||||
case 2:
|
||||
language_package_selection = LP_CUSTOM;
|
||||
break;
|
||||
case 3:
|
||||
language_package_selection = LP_NONE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RC_LANGUAGE_COMMAND_BEGIN:
|
||||
lexrc >> language_command_begin;
|
||||
@ -2508,10 +2523,10 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_LANGUAGE_PACKAGE:
|
||||
case RC_LANGUAGE_CUSTOM_PACKAGE:
|
||||
if (ignore_system_lyxrc ||
|
||||
language_package != system_lyxrc.language_package) {
|
||||
os << "\\language_package \"" << language_package
|
||||
language_custom_package != system_lyxrc.language_custom_package) {
|
||||
os << "\\language_custom_package \"" << language_custom_package
|
||||
<< "\"\n";
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
@ -2526,12 +2541,24 @@ void LyXRC::write(ostream & os, bool ignore_system_lyxrc, string const & name) c
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
case RC_LANGUAGE_USE_BABEL:
|
||||
case RC_LANGUAGE_PACKAGE_SELECTION:
|
||||
if (ignore_system_lyxrc ||
|
||||
language_use_babel != system_lyxrc.language_use_babel) {
|
||||
os << "\\language_use_babel \""
|
||||
<< convert<string>(language_use_babel)
|
||||
<< "\"\n";
|
||||
language_package_selection != system_lyxrc.language_package_selection) {
|
||||
os << "\\language_package_selection ";
|
||||
switch (language_package_selection) {
|
||||
case LP_AUTO:
|
||||
os << "0\n";
|
||||
break;
|
||||
case LP_BABEL:
|
||||
os << "1\n";
|
||||
break;
|
||||
case LP_CUSTOM:
|
||||
os << "2\n";
|
||||
break;
|
||||
case LP_NONE:
|
||||
os << "3\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tag != RC_LAST)
|
||||
break;
|
||||
@ -2903,8 +2930,8 @@ void actOnUpdatedPrefs(LyXRC const & lyxrc_orig, LyXRC const & lyxrc_new)
|
||||
case LyXRC::RC_LANGUAGE_COMMAND_END:
|
||||
case LyXRC::RC_LANGUAGE_COMMAND_LOCAL:
|
||||
case LyXRC::RC_LANGUAGE_GLOBAL_OPTIONS:
|
||||
case LyXRC::RC_LANGUAGE_PACKAGE:
|
||||
case LyXRC::RC_LANGUAGE_USE_BABEL:
|
||||
case LyXRC::RC_LANGUAGE_CUSTOM_PACKAGE:
|
||||
case LyXRC::RC_LANGUAGE_PACKAGE_SELECTION:
|
||||
case LyXRC::RC_MAC_DONTSWAP_CTRL_META:
|
||||
case LyXRC::RC_MAC_LIKE_WORD_MOVEMENT:
|
||||
case LyXRC::RC_MACRO_EDIT_STYLE:
|
||||
@ -3188,11 +3215,11 @@ string const LyXRC::getDescription(LyXRCTags tag)
|
||||
str = _("De-select if you don't want the language(s) used as an argument to \\documentclass.");
|
||||
break;
|
||||
|
||||
case RC_LANGUAGE_PACKAGE:
|
||||
case RC_LANGUAGE_CUSTOM_PACKAGE:
|
||||
str = _("The LaTeX command for loading the language package. E.g. \"\\usepackage{babel}\", \"\\usepackage{omega}\".");
|
||||
break;
|
||||
|
||||
case RC_LANGUAGE_USE_BABEL:
|
||||
case RC_LANGUAGE_PACKAGE_SELECTION:
|
||||
str = _("De-select if you don't want babel to be used when the language of the document is the default language.");
|
||||
break;
|
||||
|
||||
|
15
src/LyXRC.h
15
src/LyXRC.h
@ -106,8 +106,8 @@ public:
|
||||
RC_LANGUAGE_COMMAND_END,
|
||||
RC_LANGUAGE_COMMAND_LOCAL,
|
||||
RC_LANGUAGE_GLOBAL_OPTIONS,
|
||||
RC_LANGUAGE_PACKAGE,
|
||||
RC_LANGUAGE_USE_BABEL,
|
||||
RC_LANGUAGE_CUSTOM_PACKAGE,
|
||||
RC_LANGUAGE_PACKAGE_SELECTION,
|
||||
RC_LOADSESSION,
|
||||
RC_MACRO_EDIT_STYLE,
|
||||
RC_MAC_DONTSWAP_CTRL_META,
|
||||
@ -379,7 +379,7 @@ public:
|
||||
///
|
||||
std::string date_insert_format;
|
||||
///
|
||||
std::string language_package;
|
||||
std::string language_custom_package;
|
||||
///
|
||||
bool language_auto_begin;
|
||||
///
|
||||
@ -393,7 +393,14 @@ public:
|
||||
///
|
||||
bool language_global_options;
|
||||
///
|
||||
bool language_use_babel;
|
||||
enum LangPackageSelection {
|
||||
LP_AUTO = 0,
|
||||
LP_BABEL,
|
||||
LP_CUSTOM,
|
||||
LP_NONE
|
||||
};
|
||||
///
|
||||
LangPackageSelection language_package_selection;
|
||||
///
|
||||
bool rtl_support;
|
||||
/// bidi cursor movement: true = visual, false = logical
|
||||
|
@ -2157,12 +2157,12 @@ PrefLanguage::PrefLanguage(GuiPreferences * form)
|
||||
this, SIGNAL(changed()));
|
||||
connect(autoEndCB, SIGNAL(clicked()),
|
||||
this, SIGNAL(changed()));
|
||||
connect(useBabelCB, SIGNAL(clicked()),
|
||||
this, SIGNAL(changed()));
|
||||
connect(globalCB, SIGNAL(clicked()),
|
||||
connect(languagePackageCO, SIGNAL(activated(int)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(languagePackageED, SIGNAL(textChanged(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(globalCB, SIGNAL(clicked()),
|
||||
this, SIGNAL(changed()));
|
||||
connect(startCommandED, SIGNAL(textChanged(QString)),
|
||||
this, SIGNAL(changed()));
|
||||
connect(endCommandED, SIGNAL(textChanged(QString)),
|
||||
@ -2199,6 +2199,12 @@ void PrefLanguage::on_uiLanguageCO_currentIndexChanged(int)
|
||||
}
|
||||
|
||||
|
||||
void PrefLanguage::on_languagePackageCO_currentIndexChanged(int i)
|
||||
{
|
||||
languagePackageED->setEnabled(i == 2);
|
||||
}
|
||||
|
||||
|
||||
void PrefLanguage::apply(LyXRC & rc) const
|
||||
{
|
||||
// FIXME: remove rtl_support bool
|
||||
@ -2207,9 +2213,17 @@ void PrefLanguage::apply(LyXRC & rc) const
|
||||
rc.mark_foreign_language = markForeignCB->isChecked();
|
||||
rc.language_auto_begin = autoBeginCB->isChecked();
|
||||
rc.language_auto_end = autoEndCB->isChecked();
|
||||
rc.language_use_babel = useBabelCB->isChecked();
|
||||
int const p = languagePackageCO->currentIndex();
|
||||
if (p == 0)
|
||||
rc.language_package_selection = LyXRC::LP_AUTO;
|
||||
else if (p == 1)
|
||||
rc.language_package_selection = LyXRC::LP_BABEL;
|
||||
else if (p == 2)
|
||||
rc.language_package_selection = LyXRC::LP_CUSTOM;
|
||||
else if (p == 3)
|
||||
rc.language_package_selection = LyXRC::LP_NONE;
|
||||
rc.language_custom_package = fromqstr(languagePackageED->text());
|
||||
rc.language_global_options = globalCB->isChecked();
|
||||
rc.language_package = fromqstr(languagePackageED->text());
|
||||
rc.language_command_begin = fromqstr(startCommandED->text());
|
||||
rc.language_command_end = fromqstr(endCommandED->text());
|
||||
rc.gui_language = fromqstr(
|
||||
@ -2229,9 +2243,10 @@ void PrefLanguage::update(LyXRC const & rc)
|
||||
markForeignCB->setChecked(rc.mark_foreign_language);
|
||||
autoBeginCB->setChecked(rc.language_auto_begin);
|
||||
autoEndCB->setChecked(rc.language_auto_end);
|
||||
useBabelCB->setChecked(rc.language_use_babel);
|
||||
languagePackageCO->setCurrentIndex(rc.language_package_selection);
|
||||
languagePackageED->setText(toqstr(rc.language_custom_package));
|
||||
languagePackageED->setEnabled(languagePackageCO->currentIndex() == 2);
|
||||
globalCB->setChecked(rc.language_global_options);
|
||||
languagePackageED->setText(toqstr(rc.language_package));
|
||||
startCommandED->setText(toqstr(rc.language_command_begin));
|
||||
endCommandED->setText(toqstr(rc.language_command_end));
|
||||
defaultDecimalPointLE->setText(toqstr(rc.default_decimal_point));
|
||||
|
@ -392,6 +392,7 @@ public:
|
||||
|
||||
private Q_SLOTS:
|
||||
void on_uiLanguageCO_currentIndexChanged(int);
|
||||
void on_languagePackageCO_currentIndexChanged(int);
|
||||
};
|
||||
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="uiLanguageLA">
|
||||
<property name="text">
|
||||
<string>User &interface language:</string>
|
||||
@ -23,7 +23,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="uiLanguageCO">
|
||||
<property name="toolTip">
|
||||
<string>Select the language of the user interface (menus, dialogs, etc.)</string>
|
||||
@ -33,24 +33,55 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="languagePackageLA">
|
||||
<property name="text">
|
||||
<string>Language pac&kage:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>languagePackageED</cstring>
|
||||
<cstring>languagePackageCO</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLineEdit" name="languagePackageED">
|
||||
<property name="toolTip">
|
||||
<string>Enter the command to load the language package (default: babel)</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="1" column="1" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QComboBox" name="languagePackageCO">
|
||||
<property name="toolTip">
|
||||
<string>Select which language package LyX should use</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Automatic</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Always Babel</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Custom</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>None</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="languagePackageED">
|
||||
<property name="toolTip">
|
||||
<string>Enter the command to load the language package (default: babel)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="startCommandLA">
|
||||
<property name="text">
|
||||
<string>Command s&tart:</string>
|
||||
@ -60,14 +91,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="startCommandED">
|
||||
<property name="toolTip">
|
||||
<string>The LaTeX command that starts a switch to a foreign language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<item row="2" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@ -80,7 +111,7 @@
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="endCommandLA">
|
||||
<property name="text">
|
||||
<string>Command e&nd:</string>
|
||||
@ -90,14 +121,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="endCommandED">
|
||||
<property name="toolTip">
|
||||
<string>The LaTeX command that ends a switch to a foreign language</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="decimalPointL">
|
||||
<property name="text">
|
||||
<string>Default Decimal &Point:</string>
|
||||
@ -107,7 +138,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="defaultDecimalPointLE">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
@ -124,26 +155,16 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="useBabelCB">
|
||||
<property name="toolTip">
|
||||
<string>Use the babel package for multilingual support</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Use babel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="globalCB">
|
||||
<property name="toolTip">
|
||||
<string>Check to pass the language globally (to the document class), not locally (to the language package)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Global</string>
|
||||
<string>Set languages &globally</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="autoBeginCB">
|
||||
<property name="toolTip">
|
||||
<string>If checked, the document language is not explicitly set by a language switch command</string>
|
||||
@ -153,7 +174,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="autoEndCB">
|
||||
<property name="toolTip">
|
||||
<string>If checked, the document language is not explicitly closed by a language switch command</string>
|
||||
@ -163,7 +184,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="0" colspan="3">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="markForeignCB">
|
||||
<property name="toolTip">
|
||||
<string>Check to highlight foreign languages visually in the work area</string>
|
||||
@ -173,7 +194,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0" colspan="4">
|
||||
<item row="9" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="rtlGB2">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
@ -251,7 +272,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="11" column="1">
|
||||
<item row="10" column="0">
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@ -275,7 +296,6 @@
|
||||
<tabstop>startCommandED</tabstop>
|
||||
<tabstop>endCommandED</tabstop>
|
||||
<tabstop>defaultDecimalPointLE</tabstop>
|
||||
<tabstop>useBabelCB</tabstop>
|
||||
<tabstop>globalCB</tabstop>
|
||||
<tabstop>autoBeginCB</tabstop>
|
||||
<tabstop>autoEndCB</tabstop>
|
||||
|
Loading…
Reference in New Issue
Block a user