mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 05:16:21 +00:00
Structure the broken InsetRef status
This commit is contained in:
parent
d870a0f2fd
commit
d7bcab5e27
@ -339,19 +339,27 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!buffer().params().isLatex() && !getParam("name").empty()) {
|
||||
label += "||";
|
||||
label += getParam("name");
|
||||
}
|
||||
|
||||
|
||||
unsigned int const maxLabelChars = 24;
|
||||
if (label.size() > maxLabelChars) {
|
||||
tooltip_ = label;
|
||||
support::truncateWithEllipsis(label, maxLabelChars);
|
||||
} else
|
||||
tooltip_ = from_ascii("");
|
||||
|
||||
screen_label_ = label;
|
||||
broken_ = false;
|
||||
}
|
||||
|
||||
|
||||
docstring InsetRef::screenLabel() const
|
||||
{
|
||||
return (broken_ ? _("BROKEN: ") : docstring()) + screen_label_;
|
||||
}
|
||||
|
||||
|
||||
@ -364,9 +372,10 @@ void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
|
||||
return;
|
||||
|
||||
// It seems that this reference does not point to any valid label.
|
||||
screen_label_ = _("BROKEN: ") + screen_label_;
|
||||
|
||||
broken_ = true;
|
||||
shared_ptr<Toc> toc = backend.toc("label");
|
||||
toc->push_back(TocItem(cpit, 0, screen_label_, output_active));
|
||||
toc->push_back(TocItem(cpit, 0, screenLabel(), output_active));
|
||||
}
|
||||
|
||||
|
||||
@ -435,7 +444,7 @@ string const & InsetRef::getName(int type)
|
||||
|
||||
docstring InsetRef::getTOCString() const
|
||||
{
|
||||
return tooltip_.empty() ? screen_label_ : tooltip_;
|
||||
return tooltip_.empty() ? screenLabel() : tooltip_;
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
int docbook(odocstream &, OutputParams const &) const;
|
||||
///
|
||||
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
||||
///
|
||||
///
|
||||
void toString(odocstream &) const;
|
||||
///
|
||||
void forOutliner(docstring &, size_t const, bool const) const;
|
||||
@ -88,13 +88,6 @@ public:
|
||||
static bool isCompatibleCommand(std::string const & s);
|
||||
//@}
|
||||
|
||||
//FIXME: private
|
||||
/// \name Private functions inherited from InsetCommand class
|
||||
//@{
|
||||
///
|
||||
docstring screenLabel() const { return screen_label_; }
|
||||
//@}
|
||||
|
||||
protected:
|
||||
///
|
||||
InsetRef(InsetRef const &);
|
||||
@ -105,7 +98,13 @@ private:
|
||||
///
|
||||
Inset * clone() const { return new InsetRef(*this); }
|
||||
//@}
|
||||
|
||||
|
||||
/// \name Private functions inherited from InsetCommand class
|
||||
//@{
|
||||
///
|
||||
docstring screenLabel() const;
|
||||
//@}
|
||||
|
||||
/// \return the label with things that need to be escaped escaped
|
||||
docstring getEscapedLabel(OutputParams const &) const;
|
||||
/// \return the command for a formatted reference to ref
|
||||
@ -118,6 +117,8 @@ private:
|
||||
///
|
||||
mutable docstring screen_label_;
|
||||
///
|
||||
mutable bool broken_;
|
||||
///
|
||||
mutable docstring tooltip_;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user