mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Disable unsupported ref types in mathed.
Also repair prettyref in InsetMathRef. Part of #9798
This commit is contained in:
parent
1fb1b0a3f8
commit
47e85b37eb
@ -18,6 +18,8 @@
|
|||||||
#include "Buffer.h"
|
#include "Buffer.h"
|
||||||
#include "BufferParams.h"
|
#include "BufferParams.h"
|
||||||
#include "BufferList.h"
|
#include "BufferList.h"
|
||||||
|
#include "BufferView.h"
|
||||||
|
#include "Cursor.h"
|
||||||
#include "FuncRequest.h"
|
#include "FuncRequest.h"
|
||||||
|
|
||||||
#include "qt_helpers.h"
|
#include "qt_helpers.h"
|
||||||
@ -293,10 +295,26 @@ void GuiRef::closeEvent(QCloseEvent * e)
|
|||||||
|
|
||||||
void GuiRef::updateContents()
|
void GuiRef::updateContents()
|
||||||
{
|
{
|
||||||
int orig_type = typeCO->currentIndex();
|
QString const orig_type =
|
||||||
|
typeCO->itemData(typeCO->currentIndex()).toString();
|
||||||
|
|
||||||
referenceED->clear();
|
referenceED->clear();
|
||||||
nameED->clear();
|
nameED->clear();
|
||||||
|
typeCO->clear();
|
||||||
|
|
||||||
|
// FIXME Bring InsetMathRef on par with InsetRef
|
||||||
|
// (see #9798)
|
||||||
|
typeCO->addItem(qt_("<reference>"), "ref");
|
||||||
|
typeCO->addItem(qt_("(<reference>)"), "eqref");
|
||||||
|
typeCO->addItem(qt_("<page>"), "pageref");
|
||||||
|
typeCO->addItem(qt_("on page <page>"), "vpageref");
|
||||||
|
typeCO->addItem(qt_("<reference> on page <page>"), "vref");
|
||||||
|
if (bufferview()->cursor().inTexted()) {
|
||||||
|
typeCO->addItem(qt_("Formatted reference"), "formatted");
|
||||||
|
typeCO->addItem(qt_("Textual reference"), "nameref");
|
||||||
|
typeCO->addItem(qt_("Label only"), "labelonly");
|
||||||
|
} else
|
||||||
|
typeCO->addItem(qt_("Formatted reference"), "prettyref");
|
||||||
|
|
||||||
referenceED->setText(toqstr(params_["reference"]));
|
referenceED->setText(toqstr(params_["reference"]));
|
||||||
nameED->setText(toqstr(params_["name"]));
|
nameED->setText(toqstr(params_["name"]));
|
||||||
@ -305,10 +323,15 @@ void GuiRef::updateContents()
|
|||||||
|
|
||||||
// restore type settings for new insets
|
// restore type settings for new insets
|
||||||
bool const new_inset = params_["reference"].empty();
|
bool const new_inset = params_["reference"].empty();
|
||||||
if (new_inset)
|
if (new_inset) {
|
||||||
typeCO->setCurrentIndex(orig_type);
|
int index = typeCO->findData(orig_type);
|
||||||
|
if (index == -1)
|
||||||
|
index = 0;
|
||||||
|
typeCO->setCurrentIndex(index);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
typeCO->setCurrentIndex(InsetRef::getType(params_.getCmdName()));
|
typeCO->setCurrentIndex(
|
||||||
|
typeCO->findData(toqstr(params_.getCmdName())));
|
||||||
typeCO->setEnabled(typeAllowed() && !isBufferReadonly());
|
typeCO->setEnabled(typeAllowed() && !isBufferReadonly());
|
||||||
if (!typeAllowed())
|
if (!typeAllowed())
|
||||||
typeCO->setCurrentIndex(0);
|
typeCO->setCurrentIndex(0);
|
||||||
@ -350,7 +373,7 @@ void GuiRef::applyView()
|
|||||||
{
|
{
|
||||||
last_reference_ = referenceED->text();
|
last_reference_ = referenceED->text();
|
||||||
|
|
||||||
params_.setCmdName(InsetRef::getName(typeCO->currentIndex()));
|
params_.setCmdName(fromqstr(typeCO->itemData(typeCO->currentIndex()).toString()));
|
||||||
params_["reference"] = qstring_to_ucs4(last_reference_);
|
params_["reference"] = qstring_to_ucs4(last_reference_);
|
||||||
params_["name"] = qstring_to_ucs4(nameED->text());
|
params_["name"] = qstring_to_ucs4(nameED->text());
|
||||||
params_["plural"] = pluralCB->isChecked() ?
|
params_["plural"] = pluralCB->isChecked() ?
|
||||||
|
@ -56,6 +56,7 @@ bool InsetRef::isCompatibleCommand(string const & s) {
|
|||||||
|| s == "vref"
|
|| s == "vref"
|
||||||
|| s == "vpageref"
|
|| s == "vpageref"
|
||||||
|| s == "formatted"
|
|| s == "formatted"
|
||||||
|
|| s == "prettyref" // for InsetMathRef FIXME
|
||||||
|| s == "eqref"
|
|| s == "eqref"
|
||||||
|| s == "nameref"
|
|| s == "nameref"
|
||||||
|| s == "labelonly";
|
|| s == "labelonly";
|
||||||
|
Loading…
Reference in New Issue
Block a user