Author: toshok
Date: 2006-08-10 16:18:24 -0400 (Thu, 10 Aug 2006)
New Revision: 63623
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Menu.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
Log:
2006-08-10 Chris Toshok <[EMAIL PROTECTED]>
* Menu.cs, MainMenu.cs, MenuAPI.cs: get rid of most of the
flickering by setting a clip rectangle on the Graphics when we
need to redraw just a particular menuitem. Also, rename "OnClick"
to "OnMouseDown" to reflect what it actually is.
* Form.cs: track the OnMouseDown change.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-08-10 19:44:55 UTC (rev 63622)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-08-10 20:18:24 UTC (rev 63623)
@@ -1,3 +1,12 @@
+2006-08-10 Chris Toshok <[EMAIL PROTECTED]>
+
+ * Menu.cs, MainMenu.cs, MenuAPI.cs: get rid of most of the
+ flickering by setting a clip rectangle on the Graphics when we
+ need to redraw just a particular menuitem. Also, rename "OnClick"
+ to "OnMouseDown" to reflect what it actually is.
+
+ * Form.cs: track the OnMouseDown change.
+
2006-08-10 Peter Dennis Bartok <[EMAIL PROTECTED]>
* CommonDialog.cs: Properly inherit the CreateParams from the form
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2006-08-10 19:44:55 UTC (rev 63622)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2006-08-10 20:18:24 UTC (rev 63623)
@@ -1875,7 +1875,7 @@
args = new MouseEventArgs
(FromParamToMouseButtons ((int) m.WParam.ToInt32()),
mouse_clicks, LowOrder
((int) m.LParam.ToInt32 ()), HighOrder ((int) m.LParam.ToInt32 ()), 0);
- active_tracker.OnClick(new
MouseEventArgs (args.Button, args.Clicks, Control.MousePosition.X,
Control.MousePosition.Y, args.Delta));
+ active_tracker.OnMouseDown(new
MouseEventArgs (args.Button, args.Clicks, Control.MousePosition.X,
Control.MousePosition.Y, args.Delta));
return;
}
base.WndProc(ref m);
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs
2006-08-10 19:44:55 UTC (rev 63622)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MainMenu.cs
2006-08-10 20:18:24 UTC (rev 63623)
@@ -90,10 +90,15 @@
#region Private Methods
internal void Draw () {
+ Draw (Rect);
+ }
+
+ internal void Draw (Rectangle clip_rect) {
PaintEventArgs pe;
if (Wnd.IsHandleCreated) {
pe = XplatUI.PaintEventStart(Wnd.window.Handle,
false);
+ pe.Graphics.Clip = new Region (clip_rect);
Draw (pe, Rect);
XplatUI.PaintEventEnd(Wnd.window.Handle, false);
}
@@ -118,6 +123,11 @@
if (Paint != null)
Paint (this, pe);
}
+
+ internal override void InvalidateItem (MenuItem item)
+ {
+ Draw (item.bounds);
+ }
internal void SetForm (Form form)
{
@@ -134,15 +144,13 @@
if (form == null)
return;
- Height = 0;
-
- Draw ();
+ form.Invalidate (Rect);
}
/* Mouse events from the form */
internal void OnMouseDown (object window, MouseEventArgs args)
{
- tracker.OnClick (args);
+ tracker.OnMouseDown (args);
}
internal void OnMouseMove (object window, MouseEventArgs e)
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Menu.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Menu.cs
2006-08-10 19:44:55 UTC (rev 63622)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Menu.cs
2006-08-10 20:18:24 UTC (rev 63623)
@@ -222,6 +222,12 @@
return null;
}
+ internal virtual void InvalidateItem (MenuItem item)
+ {
+ if (Wnd != null)
+ Wnd.Invalidate (item.bounds);
+ }
+
public virtual void MergeMenu (Menu menuSrc)
{
if (menuSrc == this)
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
2006-08-10 19:44:55 UTC (rev 63622)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuAPI.cs
2006-08-10 20:18:24 UTC (rev 63623)
@@ -84,8 +84,16 @@
PopUpWindow puw = TopMenu.Wnd as PopUpWindow;
puw.HideWindow ();
} else {
+#if false
+ MenuItem item = TopMenu.SelectedItem;
+ if (item.IsPopup)
+ HideSubPopups (item);
+
+ Menu menu = item.Parent;
+ menu.InvalidateItem (item);
+#else
DeselectItem (TopMenu.SelectedItem);
- (TopMenu as MainMenu).Draw ();
+#endif
}
CurrentMenu = TopMenu;
}
@@ -116,7 +124,7 @@
return item;
}
- public void OnClick (MouseEventArgs args)
+ public void OnMouseDown (MouseEventArgs args)
{
if ((args.Button & MouseButtons.Left) == 0)
return;
@@ -135,8 +143,7 @@
if (item.IsPopup) {
active = true;
grab_control.ActiveTracker = this;
- if (item.Parent is MainMenu)
- (item.Parent as MainMenu).Draw ();
+ item.Parent.InvalidateItem (item);
} else if (item.Parent is MainMenu)
active = false;
else
@@ -231,10 +238,7 @@
HideSubPopups (item);
Menu menu = item.Parent;
- if (menu is MainMenu)
- (menu as MainMenu).Draw ();
- else if (menu.Wnd != null)
- menu.Wnd.Invalidate (item.bounds);
+ menu.InvalidateItem (item);
}
void SelectItem (Menu menu, MenuItem item, bool execute)
@@ -246,13 +250,10 @@
if (CurrentMenu != menu)
CurrentMenu = menu;
item.Selected = true;
- if (menu is MainMenu)
- (menu as MainMenu).Draw ();
- else
- menu.Wnd.Invalidate (item.bounds);
+ menu.InvalidateItem (item);
item.PerformSelect ();
}
-
+
if (execute)
ExecFocusedItem (menu, item);
}
@@ -690,9 +691,8 @@
public void ShowWindow ()
{
+ RefreshItems ();
Show ();
- RefreshItems ();
- Refresh ();
}
internal override void OnPaintInternal (PaintEventArgs args)
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches