Merge branch 'master' of git.lyx.org:lyx

This commit is contained in:
Uwe Stöhr 2013-03-19 00:57:50 +01:00
commit 575d98664a
6 changed files with 38 additions and 15 deletions

View File

@ -3269,10 +3269,10 @@ void Buffer::listParentMacros(MacroSet & macros, LaTeXFeatures & features) const
} }
Buffer::References & Buffer::references(docstring const & label) Buffer::References & Buffer::getReferenceCache(docstring const & label)
{ {
if (d->parent()) if (d->parent())
return const_cast<Buffer *>(masterBuffer())->references(label); return const_cast<Buffer *>(masterBuffer())->getReferenceCache(label);
RefCache::iterator it = d->ref_cache_.find(label); RefCache::iterator it = d->ref_cache_.find(label);
if (it != d->ref_cache_.end()) if (it != d->ref_cache_.end())
@ -3288,7 +3288,14 @@ Buffer::References & Buffer::references(docstring const & label)
Buffer::References const & Buffer::references(docstring const & label) const Buffer::References const & Buffer::references(docstring const & label) const
{ {
return const_cast<Buffer *>(this)->references(label); return const_cast<Buffer *>(this)->getReferenceCache(label);
}
void Buffer::addReference(docstring const & label, Inset * inset, ParIterator it)
{
References & refs = getReferenceCache(label);
refs.push_back(make_pair(inset, it));
} }

View File

@ -660,10 +660,15 @@ public:
/// ///
typedef std::vector<std::pair<Inset *, ParIterator> > References; typedef std::vector<std::pair<Inset *, ParIterator> > References;
References & references(docstring const & label); ///
References const & references(docstring const & label) const; References const & references(docstring const & label) const;
///
void addReference(docstring const & label, Inset * inset, ParIterator it);
///
void clearReferenceCache() const; void clearReferenceCache() const;
///
void setInsetLabel(docstring const & label, InsetLabel const * il); void setInsetLabel(docstring const & label, InsetLabel const * il);
///
InsetLabel const * insetLabel(docstring const & label) const; InsetLabel const * insetLabel(docstring const & label) const;
/// return a list of all used branches (also in children) /// return a list of all used branches (also in children)
@ -713,6 +718,8 @@ private:
/// mark the buffer as busy exporting something, or not /// mark the buffer as busy exporting something, or not
void setExportStatus(bool e) const; void setExportStatus(bool e) const;
///
References & getReferenceCache(docstring const & label);
/// Change name of buffer. Updates "read-only" flag. /// Change name of buffer. Updates "read-only" flag.
void setFileName(support::FileName const & fname); void setFileName(support::FileName const & fname);
/// ///

View File

@ -1064,6 +1064,8 @@ void GuiView::updateStatusBar()
void GuiView::showMessage() void GuiView::showMessage()
{ {
if (busy_)
return;
QString msg = toqstr(theGuiApp()->viewStatusMessage()); QString msg = toqstr(theGuiApp()->viewStatusMessage());
if (msg.isEmpty()) { if (msg.isEmpty()) {
BufferView const * bv = currentBufferView(); BufferView const * bv = currentBufferView();

View File

@ -109,9 +109,9 @@ void InsetLabel::updateLabelAndRefs(docstring const & new_label,
void InsetLabel::updateReferences(docstring const & old_label, void InsetLabel::updateReferences(docstring const & old_label,
docstring const & new_label) docstring const & new_label)
{ {
Buffer::References & refs = buffer().references(old_label); Buffer::References const & refs = buffer().references(old_label);
Buffer::References::iterator it = refs.begin(); Buffer::References::const_iterator it = refs.begin();
Buffer::References::iterator end = refs.end(); Buffer::References::const_iterator end = refs.end();
for (; it != end; ++it) { for (; it != end; ++it) {
buffer().undo().recordUndo(CursorData(it->second)); buffer().undo().recordUndo(CursorData(it->second));
if (it->first->lyxCode() == MATH_REF_CODE) { if (it->first->lyxCode() == MATH_REF_CODE) {

View File

@ -222,14 +222,21 @@ docstring InsetRef::xhtml(XHTMLStream & xs, OutputParams const &) const
// normally, would be "ref on page #", but we have no pages // normally, would be "ref on page #", but we have no pages
display_string = value; display_string = value;
else if (cmd == "pageref" || cmd == "vpageref") else if (cmd == "pageref" || cmd == "vpageref")
// normally would be "on page #", but we have no pages // normally would be "on page #", but we have no pages.
display_string = _("elsewhere"); // FIXME this is wrong, as it should be the current language,
// but it is better than _(), which is what we had before.
display_string = buffer().B_("elsewhere");
else if (cmd == "eqref") else if (cmd == "eqref")
display_string = '(' + value + ')'; display_string = '(' + value + ')';
else if (cmd == "formatted" else if (cmd == "formatted")
// we don't really have the ability to handle these display_string = il->prettyCounter();
// properly in XHTML output else if (cmd == "nameref")
|| cmd == "nameref") // FIXME We don't really have the ability to handle these
// properly in XHTML output yet (bug #8599).
// It might not be that hard to do. We have the InsetLabel,
// and we can presumably find its paragraph using the TOC.
// We could then output the contents of the paragraph using
// something?
display_string = il->prettyCounter(); display_string = il->prettyCounter();
} else } else
display_string = ref; display_string = ref;
@ -265,7 +272,7 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType)
{ {
docstring const & ref = getParam("reference"); docstring const & ref = getParam("reference");
// register this inset into the buffer reference cache. // register this inset into the buffer reference cache.
buffer().references(ref).push_back(make_pair(this, it)); buffer().addReference(ref, this, it);
docstring label; docstring label;
for (int i = 0; !types[i].latex_name.empty(); ++i) { for (int i = 0; !types[i].latex_name.empty(); ++i) {

View File

@ -184,7 +184,7 @@ void InsetMathRef::updateBuffer(ParIterator const & it, UpdateType /*utype*/)
return; return;
} }
// register this inset into the buffer reference cache. // register this inset into the buffer reference cache.
buffer().references(getTarget()).push_back(make_pair(this, it)); buffer().addReference(getTarget(), this, it);
} }