commit d29baf59a4a69ad022bca7ee63b3512838b295a2 Author: Juergen Spitzmueller <sp...@lyx.org> Date: Sat Apr 13 10:07:18 2024 +0200
Disable language package choice if the class preloads a package (cherry picked from commit 5477451e36cd9ff4e99aefea2627fbf63e028004) --- src/frontends/qt/GuiDocument.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp index d4471cff7b..e020ab92c2 100644 --- a/src/frontends/qt/GuiDocument.cpp +++ b/src/frontends/qt/GuiDocument.cpp @@ -4217,15 +4217,30 @@ void GuiDocument::paramsToDialog() // LaTeX input encoding: set after the fonts (see below) - int p = langModule->languagePackageCO->findData(toqstr(bp_.lang_package)); + // If the class provides babel or polyglossia, do not allow + // to change that + bool const extern_babel = + documentClass().provides("babel"); + bool const extern_polyglossia = + documentClass().provides("polyglossia"); + + int p = -1; + if (extern_babel) + p = langModule->languagePackageCO->findData(toqstr("babel")); + else if (extern_polyglossia) + p = langModule->languagePackageCO->findData(toqstr("polyglossia")); + else + p = langModule->languagePackageCO->findData(toqstr(bp_.lang_package)); + if (p == -1) { langModule->languagePackageCO->setCurrentIndex( - langModule->languagePackageCO->findData("custom")); + langModule->languagePackageCO->findData("custom")); langModule->languagePackageLE->setText(toqstr(bp_.lang_package)); } else { langModule->languagePackageCO->setCurrentIndex(p); langModule->languagePackageLE->clear(); } + langModule->languagePackageCO->setEnabled(!extern_babel && !extern_polyglossia); //color if (bp_.isfontcolor) { -- lyx-cvs mailing list lyx-cvs@lists.lyx.org http://lists.lyx.org/mailman/listinfo/lyx-cvs