]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiDocument.cpp
Use QFontMetrics information for underlines (and friends) width and position
[lyx.git] / src / frontends / qt4 / GuiDocument.cpp
index 18b1ddfbe6b010f93acc10a173a7cb2f4096dd5a..96ea215f080634a66967b5c416689f7dec49d9de 100644 (file)
@@ -31,6 +31,7 @@
 #include "BufferView.h"
 #include "Color.h"
 #include "ColorCache.h"
+#include "Cursor.h"
 #include "Encoding.h"
 #include "FloatPlacement.h"
 #include "Format.h"
@@ -51,6 +52,7 @@
 #include "Spacing.h"
 #include "TextClass.h"
 #include "Undo.h"
+#include "VSpace.h"
 
 #include "insets/InsetListingsParams.h"
 
@@ -2604,9 +2606,16 @@ void GuiDocument::applyView()
        bp_.quotes_language = (InsetQuotes::QuoteLanguage) langModule->quoteStyleCO->itemData(
                langModule->quoteStyleCO->currentIndex()).toInt();
 
-       QString const lang = langModule->languageCO->itemData(
+       QString const langname = langModule->languageCO->itemData(
                langModule->languageCO->currentIndex()).toString();
-       bp_.language = lyx::languages.getLanguage(fromqstr(lang));
+       Language const * newlang = lyx::languages.getLanguage(fromqstr(langname));
+       Cursor & cur = const_cast<BufferView *>(bufferview())->cursor();
+       // If current cursor language was the document language, then update it too.
+       if (cur.current_font.language() == bp_.language) {
+               cur.current_font.setLanguage(newlang);
+               cur.real_current_font.setLanguage(newlang);
+       }
+       bp_.language = newlang;
 
        QString const pack = langModule->languagePackageCO->itemData(
                langModule->languagePackageCO->currentIndex()).toString();
@@ -2985,7 +2994,7 @@ void GuiDocument::paramsToDialog()
        biblioChanged_ = false;
 
        // indices
-       indicesModule->update(bp_);
+       indicesModule->update(bp_, buffer().isReadonly());
 
        // language & quotes
        int const pos = langModule->languageCO->findData(toqstr(