show what's being undone as a tooltip
authorRichard Fairhurst <richard@systemed.net>
Tue, 4 Jan 2011 15:24:11 +0000 (15:24 +0000)
committerRichard Fairhurst <richard@systemed.net>
Tue, 4 Jan 2011 15:24:11 +0000 (15:24 +0000)
net/systemeD/halcyon/connection/CompositeUndoableAction.as
net/systemeD/halcyon/connection/MainUndoStack.as
potlatch2.mxml

index d204324248a8ff7eac67caa449bce99be6ecd7ce..ffec7dc0be552b5046c9cc07b414e58ca1e8942e 100644 (file)
@@ -14,7 +14,7 @@ package net.systemeD.halcyon.connection {
 
     public class CompositeUndoableAction extends UndoableAction {
         
-        private var name:String;
+        public var name:String;
         private var actions:Array = [];
         private var actionsDone:Boolean = false;
 
index 15618217b764a7d8bc545ea20bd2715aeb42373c..be75b6dceda74b9128c717011e462a5b1b90f49e 100644 (file)
@@ -104,6 +104,13 @@ package net.systemeD.halcyon.connection {
                        }
                }
 
+        [Bindable(event="new_undo_item")]
+               public function getUndoDescription():String {
+                       if (undoActions.length==0) return null;
+                       if (undoActions[undoActions.length-1].name) return undoActions[undoActions.length-1].name;
+                       return null;
+               }
+
         /**
         * Takes the action most recently undone, does it, and adds it to the undo stack
         */
index 27ede9d8cf909d9c4c4f8637a836b6e7b143abf1..010c228f1d8035033ed03141a74f12aa299c88ca 100644 (file)
@@ -40,7 +40,8 @@
                </mx:PopUpMenuButton>
         <mx:Spacer width="100%"/>
         <mx:Button label="Undo" click="MainUndoStack.getGlobalStack().undo();" styleName="appBarButton"
-            enabled="{MainUndoStack.getGlobalStack().canUndo()}"/>
+            enabled="{MainUndoStack.getGlobalStack().canUndo()}"
+            toolTip="{MainUndoStack.getGlobalStack().getUndoDescription() ? 'Undo '+MainUndoStack.getGlobalStack().getUndoDescription() : 'Undo last action'}" />
         <mx:Button label="Redo" click="MainUndoStack.getGlobalStack().redo();" styleName="appBarButton"
             enabled="{MainUndoStack.getGlobalStack().canRedo()}"/>
         <mx:Spacer width="100%"/>