]> git.lyx.org Git - lyx.git/blobdiff - src/bufferview_funcs.C
Oops...
[lyx.git] / src / bufferview_funcs.C
index 258613a1fe52c638ff444300bbf91b6fca1b88d4..4ed3413732a7a4c8fb59f63780989a631949a29c 100644 (file)
 
 #include <config.h>
 
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
 #include "bufferview_funcs.h"
-#include "frontends/LyXView.h"
 #include "BufferView.h"
 #include "paragraph.h"
 #include "lyxfont.h"
 #include "language.h"
 #include "gettext.h"
 #include "ParagraphParameters.h"
+#include "author.h"
+#include "changes.h"
 
+#include "frontends/LyXView.h"
 #include "frontends/Alert.h"
 
 #include "support/lstrings.h"
 
+#include "insets/updatableinset.h"
+
 #include "BoostFormat.h"
 
 void emph(BufferView * bv)
@@ -145,15 +145,33 @@ void fontSize(BufferView * bv, string const & size)
 // Returns the current font and depth as a message.
 string const currentState(BufferView * bv)
 {
+       if (!bv->available())
+               return string();
+
        ostringstream state;
 
-       if (!bv->available())
-               return "";
+       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)
-       LyXText * text = bv->getLyXText();
-       Buffer * buffer = bv->buffer();
        LyXFont font = text->real_current_font;
        LyXFont const & defaultfont =
                buffer->params.getLyXTextClass().defaultfont();
@@ -188,7 +206,7 @@ string const currentState(BufferView * bv)
                        state << _("Single");
                        break;
                case Spacing::Onehalf:
-                       state << _("Onehalf");
+                       state << _("OneHalf");
                        break;
                case Spacing::Double:
                        state << _("Double");
@@ -196,7 +214,7 @@ string const currentState(BufferView * bv)
                case Spacing::Other:
                        state << _("Other (")
                              << text->cursor.par()->params().spacing().getValue()
-                             << ")";
+                             << ')';
                        break;
                case Spacing::Default:
                        // should never happen, do nothing