Use combo box data rather than looking up info from InsetRef.

This commit is contained in:
Richard Kimberly Heck 2019-01-06 17:45:08 -05:00
parent 9238004c25
commit c4fdab6993
3 changed files with 4 additions and 14 deletions

View File

@ -145,10 +145,10 @@ void GuiRef::enableView(bool enable)
void GuiRef::enableBoxes() void GuiRef::enableBoxes()
{ {
bool const isFormatted = QString const reftype =
(InsetRef::getName(typeCO->currentIndex()) == "formatted"); typeCO->itemData(typeCO->currentIndex()).toString();
bool const isLabelOnly = bool const isFormatted = (reftype == "formatted");
(InsetRef::getName(typeCO->currentIndex()) == "labelonly"); bool const isLabelOnly = (reftype == "labelonly");
bool const usingRefStyle = buffer().params().use_refstyle; bool const usingRefStyle = buffer().params().use_refstyle;
pluralCB->setEnabled(isFormatted && usingRefStyle); pluralCB->setEnabled(isFormatted && usingRefStyle);
capsCB->setEnabled(isFormatted && usingRefStyle); capsCB->setEnabled(isFormatted && usingRefStyle);
@ -323,8 +323,6 @@ void GuiRef::updateContents()
// FIXME Bring InsetMathRef on par with InsetRef // FIXME Bring InsetMathRef on par with InsetRef
// (see #9798) // (see #9798)
// NOTE: The order here must be kept in sync with the defintion
// of the types[] array in InsetRef.cpp.
typeCO->addItem(qt_("<reference>"), "ref"); typeCO->addItem(qt_("<reference>"), "ref");
typeCO->addItem(qt_("(<reference>)"), "eqref"); typeCO->addItem(qt_("(<reference>)"), "eqref");
typeCO->addItem(qt_("<page>"), "pageref"); typeCO->addItem(qt_("<page>"), "pageref");

View File

@ -494,12 +494,6 @@ int InsetRef::getType(string const & name)
} }
string const & InsetRef::getName(int type)
{
return types[type].latex_name;
}
docstring InsetRef::getTOCString() const docstring InsetRef::getTOCString() const
{ {
return tooltip_.empty() ? screenLabel() : tooltip_; return tooltip_.empty() ? screenLabel() : tooltip_;

View File

@ -31,8 +31,6 @@ public:
static const type_info types[]; static const type_info types[];
/// ///
static int getType(std::string const & name); static int getType(std::string const & name);
///
static std::string const & getName(int type);
/// ///
InsetRef(Buffer * buffer, InsetCommandParams const &); InsetRef(Buffer * buffer, InsetCommandParams const &);