Author: toshok
Date: 2006-07-07 00:15:57 -0400 (Fri, 07 Jul 2006)
New Revision: 62339

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs
Log:
2006-07-07  Chris Toshok  <[EMAIL PROTECTED]>

        * LinkLabel.cs (CreatePiecesFromText): if the link's range piece
        is beyond the end of the text, don't do anything.
        (CreateLinkPieces): set our ControlStyles.Selectable based on
        whether or not we have any links.
        (Link.Invalidate): use a loop instead of foreach.
        (Link.set_Start): null out owner.sorted_links so it'll be
        recreated by CreateLinkPieces.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-07-07 04:07:47 UTC (rev 62338)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-07-07 04:15:57 UTC (rev 62339)
@@ -1,3 +1,13 @@
+2006-07-07  Chris Toshok  <[EMAIL PROTECTED]>
+
+       * LinkLabel.cs (CreatePiecesFromText): if the link's range piece
+       is beyond the end of the text, don't do anything.
+       (CreateLinkPieces): set our ControlStyles.Selectable based on
+       whether or not we have any links.
+       (Link.Invalidate): use a loop instead of foreach.
+       (Link.set_Start): null out owner.sorted_links so it'll be
+       recreated by CreateLinkPieces.
+
 2006-07-06  Chris Toshok  <[EMAIL PROTECTED]>
 
        * LinkLabel.cs: revert the SetStyle change.

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs     
2006-07-07 04:07:47 UTC (rev 62338)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/LinkLabel.cs     
2006-07-07 04:15:57 UTC (rev 62339)
@@ -480,6 +480,9 @@
 
                        if (start + len > Text.Length)
                                len = Text.Length - start;
+                       if (len < 0)
+                               return rv;
+
                        string t = Text.Substring (start, len);
 
                        int ps = 0;
@@ -502,9 +505,17 @@
 
                private void CreateLinkPieces ()
                {
-                       if (Links.Count == 0 || IsHandleCreated == false || 
Text.Length == 0)
+                       if (Links.Count == 0 || Text.Length == 0) {
+                               SetStyle (ControlStyles.Selectable, false);
                                return;
+                       }
 
+                       SetStyle (ControlStyles.Selectable, true);
+
+                       /* don't bother doing the rest if our handle hasn't 
been created */
+                       if (!IsHandleCreated)
+                               return;
+
                        if (Links.Count == 1 && Links[0].Start == 0 &&  
Links[0].Length == -1)
                                Links[0].Length = Text.Length;
 
@@ -683,7 +694,7 @@
                                        if (enabled != value)
                                                Invalidate ();
 
-                                       enabled = value;        
+                                       enabled = value;
                                }
                        }
 
@@ -697,7 +708,7 @@
                                }
                                set {
                                        if (length == value)
-                                               return;                         
                
+                                               return;
                                        
                                        length = value;
 
@@ -718,6 +729,7 @@
 
                                        start = value;
 
+                                       owner.sorted_links = null;
                                        owner.CreateLinkPieces ();
                                }
                        }
@@ -761,8 +773,8 @@
 
                        private void Invalidate ()
                        {
-                               foreach (Piece p in pieces)
-                                       owner.Invalidate (p.region);
+                               for (int i = 0; i < pieces.Count; i ++)
+                                       owner.Invalidate 
(((Piece)pieces[i]).region);
                        }
 
                        internal bool Contains (int x, int y)

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

Reply via email to