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 d204324..ffec7dc 100644 (file)
@@ -14,7 +14,7 @@ package net.systemeD.halcyon.connection {
 
     public class CompositeUndoableAction extends UndoableAction {
         
 
     public class CompositeUndoableAction extends UndoableAction {
         
-        private var name:String;
+        public var name:String;
         private var actions:Array = [];
         private var actionsDone:Boolean = false;
 
         private var actions:Array = [];
         private var actionsDone:Boolean = false;
 
index 1561821..be75b6d 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
         */
         /**
         * Takes the action most recently undone, does it, and adds it to the undo stack
         */
index 27ede9d..010c228 100644 (file)
@@ -40,7 +40,8 @@
                </mx:PopUpMenuButton>
         <mx:Spacer width="100%"/>
         <mx:Button label="Undo" click="MainUndoStack.getGlobalStack().undo();" styleName="appBarButton"
                </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%"/>
         <mx:Button label="Redo" click="MainUndoStack.getGlobalStack().redo();" styleName="appBarButton"
             enabled="{MainUndoStack.getGlobalStack().canRedo()}"/>
         <mx:Spacer width="100%"/>