Modified:
/nemerle/trunk/VsIntegration/Nemerle.VisualStudio/GUI/WpfHint/Hint.cs
/nemerle/trunk/VsIntegration/Nemerle.VisualStudio/GUI/WpfHint/HintSource.cs
=======================================
--- /nemerle/trunk/VsIntegration/Nemerle.VisualStudio/GUI/WpfHint/Hint.cs
Mon Nov 2 09:09:59 2009
+++ /nemerle/trunk/VsIntegration/Nemerle.VisualStudio/GUI/WpfHint/Hint.cs
Mon Nov 2 13:36:32 2009
@@ -45,8 +45,13 @@
set
{
_text = value;
- if (_hintWindow == null) return;
- foreach (Window window in _hintWindow.OwnedWindows) window.Close();
+
+ if (_hintWindow == null)
+ return;
+
+ foreach (Window window in _hintWindow.OwnedWindows)
+ window.Close();
+
_hintWindow.Text = _text;
}
}
@@ -89,7 +94,7 @@
_hintWindow = new HintWindow(this, ht) { Text = _text };
new WindowInteropHelper(_hintWindow) { Owner = _hintSource.Owner };
_hintWindow.Closed += HintWindowClosed;
- _hintWindow.MaxHeight =
1000.0;//System.Windows.Forms.Screen.FromRectangle(PlacementRect).WorkingArea.
+ _hintWindow.MaxHeight =
800.0;//System.Windows.Forms.Screen.FromRectangle(PlacementRect).WorkingArea.
_hintWindow.WrapWidth = _wrapWidth;
_hintWindow.Show();
=======================================
---
/nemerle/trunk/VsIntegration/Nemerle.VisualStudio/GUI/WpfHint/HintSource.cs
Fri Oct 30 10:58:03 2009
+++
/nemerle/trunk/VsIntegration/Nemerle.VisualStudio/GUI/WpfHint/HintSource.cs
Mon Nov 2 13:36:32 2009
@@ -1,8 +1,9 @@
using System;
+using System.Diagnostics;
namespace WpfHint
{
- internal class HintSource
+ internal class HintSource : IDisposable
{
private Win32.Callback _ownerWndProc;
private Win32.Callback _rootWndProc;
@@ -21,6 +22,8 @@
public void SubClass(IntPtr owner)
{
+ Debug.WriteLine("SubClass(): " + owner);
+
var pt = Win32.GetCursorPos();
var pt1 = new Win32.POINT(pt.X, pt.Y);
@@ -48,11 +51,18 @@
public void UnSubClass()
{
+ Debug.WriteLine("UnSubClass(): " + _owner);
if (_owner != IntPtr.Zero && _oldOwner != null)
+ {
+ _oldOwner = null;
Win32.SetWindowLong(_owner, Win32.GWL_WNDPROC, _oldOwner);
+ }
if (_root != IntPtr.Zero && _oldRoot != null)
+ {
Win32.SetWindowLong(_root, Win32.GWL_WNDPROC, _oldRoot);
+ _oldRoot = null;
+ }
}
private int WndProc(IntPtr hwnd, int msg, int wParam, int lParam)
@@ -79,5 +89,20 @@
return Win32.CallWindowProc(_oldRoot, hwnd, msg, wParam, lParam);
}
+
+ #region Implementation of IDisposable
+
+
+ ~HintSource()
+ {
+ Dispose();
+ }
+
+ public void Dispose()
+ {
+ UnSubClass();
+ }
+
+ #endregion
}
}