- string state;
- if (bv->available()) {
- // I think we should only show changes from the default
- // font. (Asger)
- Buffer * buffer = bv->buffer();
- LyXFont font = bv->text->real_current_font;
- LyXFont const & defaultfont =
- textclasslist
- .TextClass(buffer->params.textclass)
- .defaultfont();
- font.reduce(defaultfont);
- state = _("Font: ") + font.stateText(&buffer->params);
- // The paragraph depth
- int depth = bv->text->GetDepth();
- if (depth > 0)
- state += string(_(", Depth: ")) + tostr(depth);
- // The paragraph spacing, but only if different from
- // buffer spacing.
- if (!bv->text->cursor.par()->spacing.isDefault()) {
- Spacing::Space cur_space =
- bv->text->cursor.par()->spacing.getSpace();
- state += _(", Spacing: ");
- switch (cur_space) {
- case Spacing::Single:
- state += _("Single");
- break;
- case Spacing::Onehalf:
- state += _("Onehalf");
- break;
- case Spacing::Double:
- state += _("Double");
- break;
- case Spacing::Other:
- state += _("Other (");
- state += tostr(bv->text->cursor.par()->spacing.getValue());
- state += ")";
- break;
- case Spacing::Default:
- // should never happen, do nothing
- break;
- }
+ if (!bv->available())
+ return string();
+
+ if (mathcursor)
+ return mathcursor->info();
+
+ ostringstream state;
+
+ LyXText * text = bv->getLyXText();
+ Buffer * buffer = bv->buffer();
+ LyXCursor const & c(text->cursor);
+
+ bool const show_change = buffer->params.tracking_changes
+ && c.pos() != c.par()->size()
+ && c.par()->lookupChange(c.pos()) != Change::UNCHANGED;
+
+ if (show_change) {
+ Change change(c.par()->lookupChangeFull(c.pos()));
+ Author const & a(bv->buffer()->authors().get(change.author));
+ state << _("Change: ") << a.name();
+ if (!a.email().empty()) {
+ state << " (" << a.email() << ")";
+ }
+ if (change.changetime)
+ state << _(" at ") << ctime(&change.changetime);
+ state << " : ";
+ }
+
+ // I think we should only show changes from the default
+ // font. (Asger)
+ LyXFont font = text->real_current_font;
+ LyXFont const & defaultfont =
+ buffer->params.getLyXTextClass().defaultfont();
+ font.reduce(defaultfont);
+
+ // avoid _(...) re-entrance problem
+ string const s = font.stateText(&buffer->params);
+ state << bformat(_("Font: %1$s"), s);
+
+ // state << bformat(_("Font: %1$s"), font.stateText(&buffer->params));
+
+ // The paragraph depth
+ int depth = text->getDepth();
+ if (depth > 0)
+ state << bformat(_(", Depth: %1$s"), tostr(depth));
+
+ // The paragraph spacing, but only if different from
+ // buffer spacing.
+ if (!text->cursor.par()->params().spacing().isDefault()) {
+ Spacing::Space cur_space =
+ text->cursor.par()->params().spacing().getSpace();
+ state << _(", Spacing: ");
+
+ switch (cur_space) {
+ case Spacing::Single:
+ state << _("Single");
+ break;
+ case Spacing::Onehalf:
+ state << _("OneHalf");
+ break;
+ case Spacing::Double:
+ state << _("Double");
+ break;
+ case Spacing::Other:
+ state << _("Other (")
+ << text->cursor.par()->params().spacing().getValue()
+ << ')';
+ break;
+ case Spacing::Default:
+ // should never happen, do nothing
+ break;