[pdfmod] Add descriptions to undo/redo menu items



commit dcc926e1fc22b07cf2f58037d3ce61cdcb8afc0a
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Thu Aug 6 10:31:48 2009 -0700

    Add descriptions to undo/redo menu items

 lib/Hyena.dll                               |  Bin 233984 -> 234496 bytes
 src/PdfMod/PdfMod.Actions/BasePageAction.cs |    8 +++++++-
 src/PdfMod/PdfMod.Actions/MoveAction.cs     |    3 +++
 src/PdfMod/PdfMod.Actions/RotateAction.cs   |    4 ++++
 src/PdfMod/PdfMod/GlobalActions.cs          |   11 +++++++++++
 5 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/lib/Hyena.dll b/lib/Hyena.dll
index 1e5cacd..80d4f3e 100755
Binary files a/lib/Hyena.dll and b/lib/Hyena.dll differ
diff --git a/src/PdfMod/PdfMod.Actions/BasePageAction.cs b/src/PdfMod/PdfMod.Actions/BasePageAction.cs
index 2c81196..04d278c 100644
--- a/src/PdfMod/PdfMod.Actions/BasePageAction.cs
+++ b/src/PdfMod/PdfMod.Actions/BasePageAction.cs
@@ -6,10 +6,16 @@ using Hyena;
 
 namespace PdfMod.Actions
 {
-    public abstract class BasePageAction : IUndoAction
+    public interface IDescribedUndoAction : IUndoAction
+    {
+        string Description { get; }
+    }
+
+    public abstract class BasePageAction : IDescribedUndoAction
     {
         protected Document Document { get; private set; }
         protected List<Page> Pages { get; private set; }
+        public string Description { get; protected set; }
 
         public BasePageAction (Document document, IEnumerable<Page> to_remove)
         {
diff --git a/src/PdfMod/PdfMod.Actions/MoveAction.cs b/src/PdfMod/PdfMod.Actions/MoveAction.cs
index be3cf13..f3ebc16 100644
--- a/src/PdfMod/PdfMod.Actions/MoveAction.cs
+++ b/src/PdfMod/PdfMod.Actions/MoveAction.cs
@@ -20,6 +20,9 @@ namespace PdfMod.Actions
         public MoveAction (Document document, IEnumerable<Page> pages, int to_index) : base (document, pages)
         {
             this.to_index = to_index;
+            // Translators: {0} is the # of pages, {1} is a translated string summarizing the pages, eg "page 1"
+            Description = String.Format (Catalog.GetPluralString ("Move {1}", "Move {1}", Pages.Count),
+                Pages.Count, GlobalActions.GetPageSummary (Pages, 5));
         }
 
         public override void Undo ()
diff --git a/src/PdfMod/PdfMod.Actions/RotateAction.cs b/src/PdfMod/PdfMod.Actions/RotateAction.cs
index 26be09d..11ac183 100644
--- a/src/PdfMod/PdfMod.Actions/RotateAction.cs
+++ b/src/PdfMod/PdfMod.Actions/RotateAction.cs
@@ -2,6 +2,8 @@
 using System;
 using System.Collections.Generic;
 
+using Mono.Unix;
+
 namespace PdfMod.Actions
 {
     public class RotateAction : BasePageAction
@@ -11,6 +13,8 @@ namespace PdfMod.Actions
         public RotateAction (Document document, IEnumerable<Page> pages, int rotation) : base (document, pages)
         {
             this.rotation = rotation;
+            Description = String.Format (Catalog.GetPluralString ("Rotate {1}", "Rotate {1}", Pages.Count),
+                Pages.Count, GlobalActions.GetPageSummary (Pages, 5));
         }
 
         public override void Undo ()
diff --git a/src/PdfMod/PdfMod/GlobalActions.cs b/src/PdfMod/PdfMod/GlobalActions.cs
index 00af150..3081f28 100644
--- a/src/PdfMod/PdfMod/GlobalActions.cs
+++ b/src/PdfMod/PdfMod/GlobalActions.cs
@@ -146,6 +146,17 @@ namespace PdfMod
 
             UpdateAction ("UndoAction", true, have_doc && undo_manager.CanUndo);
             UpdateAction ("RedoAction", true, have_doc && undo_manager.CanRedo);
+
+            var undo = undo_manager.UndoAction as IDescribedUndoAction;
+            this["UndoAction"].Label = undo == null
+                ? Catalog.GetString ("_Undo")
+                : String.Format (Catalog.GetString ("Undo {0}"), undo.Description);
+
+            var redo = undo_manager.RedoAction as IDescribedUndoAction;
+            this["RedoAction"].Label = redo == null
+                ? Catalog.GetString ("_Redo")
+                : String.Format (Catalog.GetString ("Redo {0}"), redo.Description);
+
             UpdateActions (true, have_doc && app.Document.HasUnsavedChanged, "SaveAction", "SaveAsAction");
             UpdateAction ("ZoomInAction", true, have_doc && app.IconView.CanZoomIn);
             UpdateAction ("ZoomOutAction", true, have_doc && app.IconView.CanZoomOut);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]