]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiDocument.cpp
Move Tocs to the "Other lists" submenu based on a blacklist
[lyx.git] / src / frontends / qt4 / GuiDocument.cpp
index 19fce601564ce81835c9c233fb5724f101900385..e836bd7f98c1db683f6e9c9a24cff8f1e0149712 100644 (file)
@@ -859,18 +859,9 @@ GuiDocument::GuiDocument(GuiView & lv)
        fontModule->fontsizeCO->addItem(qt_("11"));
        fontModule->fontsizeCO->addItem(qt_("12"));
 
-       fontModule->fontencCO->addItem(qt_("Global Default"), QString("global"));
+       fontModule->fontencCO->addItem(qt_("Default"), QString("global"));
        fontModule->fontencCO->addItem(qt_("Custom"), QString("custom"));
-       fontModule->fontencCO->addItem(qt_("TeX default (OT1, no fontenc)"), QString("default"));
-       fontModule->fontencCO->setToolTip(
-                       qt_("Select LaTeX font encoding(s).\n"
-                           "The standard [Global Default] is "
-                               "\"T1 via 'fontenc' package\" (see Tools>Preferences>Output>LaTeX).\n"
-                               "Notes:\n"
-                               "TeX's default fonts (Computer Modern) are not available "
-                               "in T1 encoding, Latin Modern is the recommended lookalike.\n"
-                               "Font encodings for Greek and Cyrillic are automatically added if required."
-                          ));
+       fontModule->fontencCO->addItem(qt_("None (no fontenc)"), QString("default"));
 
        for (int n = 0; GuiDocument::fontfamilies_gui[n][0]; ++n)
                fontModule->fontsDefaultCO->addItem(
@@ -1055,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));
@@ -1076,19 +1069,6 @@ GuiDocument::GuiDocument(GuiView & lv)
        encodinglist.sort();
        langModule->encodingCO->addItems(encodinglist);
 
-       langModule->quoteStyleCO->addItem(
-               qt_("``text''"),InsetQuotes::EnglishQuotes);
-       langModule->quoteStyleCO->addItem(
-               qt_("''text''"), InsetQuotes::SwedishQuotes);
-       langModule->quoteStyleCO->addItem
-               (qt_(",,text``"), InsetQuotes::GermanQuotes);
-       langModule->quoteStyleCO->addItem(
-               qt_(",,text''"), InsetQuotes::PolishQuotes);
-       langModule->quoteStyleCO->addItem(
-               qt_("<<text>>"), InsetQuotes::FrenchQuotes);
-       langModule->quoteStyleCO->addItem(
-               qt_(">>text<<"), InsetQuotes::DanishQuotes);
-
        langModule->languagePackageCO->addItem(
                qt_("Default"), toqstr("default"));
        langModule->languagePackageCO->addItem(
@@ -1466,7 +1446,7 @@ GuiDocument::GuiDocument(GuiView & lv)
 }
 
 
-void GuiDocument::on_bufferViewChanged()
+void GuiDocument::onBufferViewChanged()
 {
        if (isVisibleView())
                initialiseParams("");
@@ -1773,6 +1753,38 @@ void GuiDocument::deleteBoxBackgroundColor()
 }
 
 
+void GuiDocument::updateQuoteStyles(bool const set)
+{
+       Language const * lang = lyx::languages.getLanguage(
+               fromqstr(langModule->languageCO->itemData(
+                       langModule->languageCO->currentIndex()).toString()));
+
+       InsetQuotesParams::QuoteStyle def = bp_.getQuoteStyle(lang->quoteStyle());
+
+       langModule->quoteStyleCO->clear();
+
+       bool has_default = false;
+       for (int i = 0; i < quoteparams.stylescount(); ++i) {
+               InsetQuotesParams::QuoteStyle qs = InsetQuotesParams::QuoteStyle(i);
+               if (qs == InsetQuotesParams::DynamicQuotes)
+                       continue;
+               bool const langdef = (qs == def);
+               if (langdef) {
+                       // add the default style on top
+                       langModule->quoteStyleCO->insertItem(0,
+                               toqstr(quoteparams.getGuiLabel(qs, langdef)), qs);
+                       has_default = true;
+               }
+               else
+                       langModule->quoteStyleCO->addItem(
+                               toqstr(quoteparams.getGuiLabel(qs, langdef)), qs);
+       }
+       if (set && has_default)
+               // (re)set to the default style
+               langModule->quoteStyleCO->setCurrentIndex(0);
+}
+
+
 void GuiDocument::languageChanged(int i)
 {
        // some languages only work with polyglossia
@@ -1797,10 +1809,7 @@ void GuiDocument::languageChanged(int i)
        }
 
        // set appropriate quotation mark style
-       if (!lang->quoteStyle().empty()) {
-               langModule->quoteStyleCO->setCurrentIndex(
-                       bp_.getQuoteStyle(lang->quoteStyle()));
-       }
+       updateQuoteStyles(true);
 }
 
 
@@ -2667,8 +2676,9 @@ void GuiDocument::applyView()
                }
        }
 
-       bp_.quotes_language = (InsetQuotes::QuoteLanguage) langModule->quoteStyleCO->itemData(
+       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();
@@ -3069,7 +3079,7 @@ void GuiDocument::paramsToDialog()
        biblioChanged_ = false;
 
        // indices
-       // We may be called when there is no Buffer, e.g., when
+       // We may be called when there is no Buffer, e.g., when 
        // the last view has just been closed.
        bool const isReadOnly = isBufferAvailable() ? buffer().isReadonly() : false;
        indicesModule->update(bp_, isReadOnly);
@@ -3079,8 +3089,11 @@ void GuiDocument::paramsToDialog()
                bp_.language->lang()));
        langModule->languageCO->setCurrentIndex(pos);
 
+       updateQuoteStyles();
+
        langModule->quoteStyleCO->setCurrentIndex(
-               bp_.quotes_language);
+               langModule->quoteStyleCO->findData(bp_.quotes_style));
+       langModule->dynamicQuotesCB->setChecked(bp_.dynamic_quotes);
 
        bool default_enc = true;
        if (bp_.inputenc != "auto") {
@@ -3401,7 +3414,7 @@ void GuiDocument::paramsToDialog()
                        toqstr(bp_.fonts_cjk));
        else
                fontModule->cjkFontLE->setText(QString());
-
+       
        fontModule->microtypeCB->setChecked(bp_.use_microtype);
 
        fontModule->fontScCB->setChecked(bp_.fonts_expert_sc);