Author: jpobst
Date: 2008-02-07 17:30:37 -0500 (Thu, 07 Feb 2008)
New Revision: 95201

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiControlStrip.cs
Log:
2008-02-07  Jonathan Pobst  <[EMAIL PROTECTED]>

        * MdiControlStrip.cs: Add property to access the mdi form tied to
        each toolstripitem.
        * MdiClient.cs: Be smarter about removing and adding toolstripitems
        to the implicitly merged menu.  Every time we clicked the form, items
        were getting removed and the re-added, causing the form to jump around
        as the menu resized.

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-02-07 22:29:35 UTC (rev 95200)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2008-02-07 22:30:37 UTC (rev 95201)
@@ -1,5 +1,14 @@
 2008-02-07  Jonathan Pobst  <[EMAIL PROTECTED]>
 
+       * MdiControlStrip.cs: Add property to access the mdi form tied to
+       each toolstripitem.
+       * MdiClient.cs: Be smarter about removing and adding toolstripitems
+       to the implicitly merged menu.  Every time we clicked the form, items
+       were getting removed and the re-added, causing the form to jump around
+       as the menu resized.
+
+2008-02-07  Jonathan Pobst  <[EMAIL PROTECTED]>
+
        * MdiClient.cs: Make sure the NormalBounds always gets set.  It
        was being reset by the implicit menu merge for menustrips.
        [Fixes bug #336296]

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs     
2008-02-07 22:29:35 UTC (rev 95200)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs     
2008-02-07 22:30:37 UTC (rev 95201)
@@ -841,13 +841,28 @@
                                        if (c is MenuStrip)
                                                child_menu = (MenuStrip)c;
 
-                               RemoveControlMenuItems (wm);
+                               if (form.WindowState != 
FormWindowState.Maximized)
+                                       RemoveControlMenuItems (wm);
                                
                                if (form.WindowState == 
FormWindowState.Maximized) {
-                                       parent_menu.Items.Insert (0, new 
MdiControlStrip.SystemMenuItem (form));
-                                       parent_menu.Items.Add (new 
MdiControlStrip.ControlBoxMenuItem (form, 
MdiControlStrip.ControlBoxType.Close));
-                                       parent_menu.Items.Add (new 
MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Max));
-                                       parent_menu.Items.Add (new 
MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Min));
+                                       bool found = false;
+                                       
+                                       foreach (ToolStripItem tsi in 
parent_menu.Items) {
+                                               if (tsi is 
MdiControlStrip.SystemMenuItem) {
+                                                       (tsi as 
MdiControlStrip.SystemMenuItem).MdiForm = form;
+                                                       found = true;
+                                               } else if (tsi is 
MdiControlStrip.ControlBoxMenuItem) {
+                                                       (tsi as 
MdiControlStrip.ControlBoxMenuItem).MdiForm = form;
+                                                       found = true;
+                                               }
+                                       }       
+                                       
+                                       if (!found) {
+                                               parent_menu.Items.Insert (0, 
new MdiControlStrip.SystemMenuItem (form));
+                                               parent_menu.Items.Add (new 
MdiControlStrip.ControlBoxMenuItem (form, 
MdiControlStrip.ControlBoxType.Close));
+                                               parent_menu.Items.Add (new 
MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Max));
+                                               parent_menu.Items.Add (new 
MdiControlStrip.ControlBoxMenuItem (form, MdiControlStrip.ControlBoxType.Min));
+                                       }
                                }
                                
                                if (child_menu != null)

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiControlStrip.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiControlStrip.cs   
    2008-02-07 22:29:35 UTC (rev 95200)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiControlStrip.cs   
    2008-02-07 22:30:37 UTC (rev 95201)
@@ -90,6 +90,11 @@
                                return;
                        }
 
+                       public Form MdiForm {
+                               get { return form; }
+                               set { form = value; }
+                       }
+
                        private void RestoreItemHandler (object sender, 
EventArgs e)
                        {
                                form.WindowState = FormWindowState.Normal;
@@ -172,6 +177,11 @@
                                }
                        }
 
+                       public Form MdiForm {
+                               get { return form; }
+                               set { form = value; }
+                       }
+                       
                        private void RestoreItemHandler (object sender, 
EventArgs e)
                        {
                                form.WindowState = FormWindowState.Normal;

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

Reply via email to