]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiBibitem.cpp
Use <cstdint> instead of <boost/cstdint.hpp>
[lyx.git] / src / frontends / qt4 / GuiBibitem.cpp
index dddb5079450bb801e085307ea3e9c73e2ff7f5bf..ccbbf95b20908cb54b31dc2eff281896a49f1484 100644 (file)
@@ -36,6 +36,8 @@ GuiBibitem::GuiBibitem(QWidget * parent) : InsetParamsWidget(parent)
                this, SIGNAL(changed()));
        connect(labelED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
+       connect(allAuthorsED, SIGNAL(textChanged(QString)),
+               this, SIGNAL(changed()));
        connect(yearED, SIGNAL(textChanged(QString)),
                this, SIGNAL(changed()));
        connect(literalCB, SIGNAL(clicked()),
@@ -50,28 +52,46 @@ void GuiBibitem::paramsToDialog(Inset const * inset)
        keyED->setText(toqstr(params["key"]));
        literalCB->setChecked(params["literal"] == "true");
        QString const label = toqstr(params["label"]);
-       BufferParams const bp = inset->buffer().masterParams();
-       if (bp.citeEngine() == "natbib" && bp.citeEngineType() == ENGINE_TYPE_AUTHORYEAR) {
+       if (inset->buffer().masterParams().citeEngine() == "natbib") {
                yearED->setHidden(false);
                yearLA->setHidden(false);
-               labelLA->setText(qt_("Author &Name:"));
-               labelED->setToolTip(qt_("Insert the author name(s) here. The year goes to the separate field."));
+               allAuthorsED->setHidden(false);
+               allAuthorsLA->setHidden(false);
+               labelLA->setText(qt_("Author &Names:"));
+               labelLA->setMaximumWidth(labelLA->sizeHint().width());
+               labelED->setToolTip(qt_("Insert the author name(s) for the author-year reference here. "
+                                       "If you use an abbreviated list (with `et al.'), the full list can go below."));
+               allAuthorsLA->setText(qt_("A&ll Author Names:"));
+               allAuthorsLA->setMaximumWidth(allAuthorsLA->sizeHint().width());
+               literalCB->setToolTip(qt_("Pass content of the `Author', `Year' and `All Authors' fields literally to LaTeX. "
+                                         "Check this if you want to enter LaTeX code."));
                int const i = label.lastIndexOf("(");
                int const j = label.lastIndexOf(")");
                if (i != -1 && j != -1 && i < j) {
-                       // Split Author(Year) to Author and Year
+                       // Split Author(s) and Year
+                       // Natbib syntax is "Jones et al.(1990)Jones, Baker, and Williams"
+                       // (full list is optional)
                        QString const year = label.left(j).mid(i + 1);
                        QString const author = label.left(i);
+                       QString const allauthors = label.mid(j + 1);
                        labelED->setText(author);
                        yearED->setText(year);
+                       allAuthorsED->setText(allauthors);
                } else
                        labelED->setText(label);
        } else {
                yearED->setHidden(true);
                yearLA->setHidden(true);
+               allAuthorsED->setHidden(true);
+               allAuthorsLA->setHidden(true);
+               allAuthorsLA->setText(qt_("&Label:"));
+               allAuthorsLA->setMaximumWidth(allAuthorsLA->sizeHint().width());
                labelLA->setText(qt_("&Label:"));
+               labelLA->setMaximumWidth(labelLA->sizeHint().width());
                labelED->setToolTip(qt_("The label as it appears in the document"));
                labelED->setText(label);
+               literalCB->setToolTip(qt_("Pass content of the `Label' field literally to LaTeX. "
+                                         "Check this if you want to enter LaTeX code."));
        }
 }
 
@@ -81,7 +101,7 @@ docstring GuiBibitem::dialogToParams() const
        InsetCommandParams params(insetCode());
        QString label = labelED->text();
        if (!yearED->isHidden())
-               label += "(" + yearED->text() + ")";
+               label += "(" + yearED->text() + ")" + allAuthorsED->text();
        params["key"] = qstring_to_ucs4(keyED->text());
        params["label"] = qstring_to_ucs4(label);
        params["literal"] = literalCB->isChecked()