Author: jackson
Date: 2006-12-11 11:02:01 -0500 (Mon, 11 Dec 2006)
New Revision: 69332

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
Log:

                * TextControl.cs: Need to track undo levels ourself,
                * since
        compound actions will mess them up.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-12-11 15:25:37 UTC (rev 69331)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-12-11 16:02:01 UTC (rev 69332)
@@ -1,3 +1,8 @@
+2006-12-11  Jackson Harper  <[EMAIL PROTECTED]>
+
+       * TextControl.cs: Need to track undo levels ourself, since
+       compound actions will mess them up.
+
 2006-12-10  Andreia Gaita  <[EMAIL PROTECTED]>
 
        * TabControl.cs: Raise SelectedIndexChanged for 1.1 if the

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs   
2006-12-11 15:25:37 UTC (rev 69331)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextControl.cs   
2006-12-11 16:02:01 UTC (rev 69332)
@@ -4657,6 +4657,9 @@
                private Document        document;
                private Stack           undo_actions;
                private Stack           redo_actions;
+
+               private int undo_levels;
+               private int redo_levels;
                private int             caret_line;
                private int             caret_pos;
                #endregion      // Local Variables
@@ -4670,26 +4673,27 @@
                #endregion      // Constructors
 
                #region Properties
-               [MonoTODO("Change this to be configurable")]
                internal int UndoLevels {
                        get {
-                               return undo_actions.Count;
+                               return undo_levels;
                        }
                }
 
-               [MonoTODO("Change this to be configurable")]
                internal int RedoLevels {
                        get {
-                               return redo_actions.Count;
+                               return redo_levels;
                        }
                }
 
-               [MonoTODO("Come up with good naming and localization")]
                internal string UndoName {
                        get {
                                Action action;
 
                                action = (Action)undo_actions.Peek();
+
+                               if (action.type == ActionType.CompoundEnd)
+                                       return (string) action.data;
+
                                switch(action.type) {
                                        case ActionType.InsertChar: {
                                                Locale.GetText("Insert 
character");
@@ -4729,6 +4733,8 @@
                internal void Clear() {
                        undo_actions.Clear();
                        redo_actions.Clear();
+                       undo_levels = 0;
+                       redo_levels = 0;
                }
 
                internal void Undo() {
@@ -4755,6 +4761,8 @@
 
                                case ActionType.CompoundBegin:
                                        compound_stack--;
+                                       undo_levels--;
+                                       redo_levels++;
                                        break;
 
                                case ActionType.InsertString:
@@ -4823,6 +4831,7 @@
                        ce.type = ActionType.CompoundEnd;
 
                        undo_actions.Push (ce);
+                       undo_levels++;
                }
 
                // pos = 1-based

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to