Generated a key to sign DockPanel Suite. Added .gitignore. Merged Mono lite mode patch from #SNMP.

This commit is contained in:
Lex Li 2012-05-18 20:30:33 +08:00
parent c10c301e35
commit 5e27774b05
17 changed files with 117 additions and 29 deletions

26
.gitignore vendored Normal file
View File

@ -0,0 +1,26 @@
build/
*.suo
*.user
_ReSharper*
*.csproj.user
*.resharper.user
*.userprefs
*.suo
*.cache
*.trx
*.pidb
Thumbs.db
[Bb]in
[Dd]ebug
[Oo]bj
[Rr]elease
[Tt]est[Rr]esult*
_UpgradeReport_Files
*[Pp]ublish.xml
*.project
*.metadata
logs
*.generated.cs
T4MVC.cs
/SharpSnmpLib/sharpsnmplib.snk
/packages

View File

@ -258,6 +258,7 @@ namespace WeifenLuo.WinFormsUI.Docking
Form.FormBorderStyle = FormBorderStyle.None;
Form.ShowInTaskbar = false;
Form.WindowState = FormWindowState.Normal;
if (!Win32Helper.IsRunningOnMono())
NativeMethods.SetWindowPos(Form.Handle, IntPtr.Zero, 0, 0, 0, 0,
Win32.FlagsSetWindowPos.SWP_NOACTIVATE |
Win32.FlagsSetWindowPos.SWP_NOMOVE |
@ -513,6 +514,7 @@ namespace WeifenLuo.WinFormsUI.Docking
if (Form.ContainsFocus)
if (DockState == DockState.Hidden || DockState == DockState.Unknown)
if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.GiveUpFocus(Content);
SetPaneAndVisible(Pane);
@ -533,8 +535,10 @@ namespace WeifenLuo.WinFormsUI.Docking
{
if (DockState == DockState.Hidden || DockState == DockState.Unknown ||
DockHelper.IsDockStateAutoHide(DockState))
if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.RemoveFromList(Content);
else
if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.AddToList(Content);
OnDockStateChanged(EventArgs.Empty);
@ -641,12 +645,14 @@ namespace WeifenLuo.WinFormsUI.Docking
DockPanel.ActiveAutoHideContent = Content;
if (!Form.ContainsFocus)
if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.Activate(Content);
}
}
public void GiveUpFocus()
{
if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.GiveUpFocus(Content);
}
@ -725,6 +731,7 @@ namespace WeifenLuo.WinFormsUI.Docking
{
//Suggested as a fix for a memory leak by bugreports
if (value == null && !IsFloat)
if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.GiveUpFocus(this.Content);
else
{

View File

@ -911,6 +911,7 @@ namespace WeifenLuo.WinFormsUI.Docking
FloatWindow = DockPanel.FloatWindowFactory.CreateFloatWindow(DockPanel, this);
if (contentFocused != null)
if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.Activate(contentFocused);
ResumeRefreshStateChange(oldContainer, oldDockState);

View File

@ -102,6 +102,7 @@ namespace WeifenLuo.WinFormsUI.Docking
if (m_activeContent != null)
{
if (m_activeContent.DockHandler.Form.ContainsFocus)
if (!Win32Helper.IsRunningOnMono())
DockPanel.ContentFocusManager.GiveUpFocus(m_activeContent);
AnimateWindow(false);
}

View File

@ -45,6 +45,7 @@ namespace WeifenLuo.WinFormsUI.Docking
StartMousePosition = Control.MousePosition;
if (!Win32Helper.IsRunningOnMono())
if (!NativeMethods.DragDetect(DragControl.Handle, StartMousePosition))
return false;

View File

@ -124,6 +124,10 @@ namespace WeifenLuo.WinFormsUI.Docking
public FocusManagerImpl(DockPanel dockPanel)
{
m_dockPanel = dockPanel;
if (Win32Helper.IsRunningOnMono())
return;
m_localWindowsHook = new LocalWindowsHook(Win32.HookType.WH_CALLWNDPROCRET);
m_hookEventHandler = new LocalWindowsHook.HookEventHandler(HookEventHandler);
m_localWindowsHook.HookInvoked += m_hookEventHandler;
@ -143,6 +147,7 @@ namespace WeifenLuo.WinFormsUI.Docking
{
if (!m_disposed && disposing)
{
if (!Win32Helper.IsRunningOnMono())
m_localWindowsHook.Dispose();
m_disposed = true;
}
@ -172,11 +177,13 @@ namespace WeifenLuo.WinFormsUI.Docking
if (handler.Form.IsDisposed)
return; // Should not reach here, but better than throwing an exception
if (ContentContains(content, handler.ActiveWindowHandle))
if (!Win32Helper.IsRunningOnMono())
NativeMethods.SetFocus(handler.ActiveWindowHandle);
if (!handler.Form.ContainsFocus)
{
if (!handler.Form.SelectNextControl(handler.Form.ActiveControl, true, true, true, true))
// Since DockContent Form is not selectalbe, use Win32 SetFocus instead
if (!Win32Helper.IsRunningOnMono())
NativeMethods.SetFocus(handler.Form.Handle);
}
}
@ -285,6 +292,7 @@ namespace WeifenLuo.WinFormsUI.Docking
public void SuspendFocusTracking()
{
m_countSuspendFocusTracking++;
if (!Win32Helper.IsRunningOnMono())
m_localWindowsHook.HookInvoked -= m_hookEventHandler;
}
@ -300,6 +308,7 @@ namespace WeifenLuo.WinFormsUI.Docking
Activate(ContentActivating);
ContentActivating = null;
}
if (!Win32Helper.IsRunningOnMono())
m_localWindowsHook.HookInvoked += m_hookEventHandler;
if (!InRefreshActiveWindow)
RefreshActiveWindow();
@ -390,7 +399,7 @@ namespace WeifenLuo.WinFormsUI.Docking
private void SetActivePane()
{
DockPane value = GetPaneFromHandle(NativeMethods.GetFocus());
DockPane value = Win32Helper.IsRunningOnMono() ? null : GetPaneFromHandle(NativeMethods.GetFocus());
if (m_activePane == value)
return;

View File

@ -87,6 +87,8 @@ namespace WeifenLuo.WinFormsUI.Docking
// "Adding designable borders to user controls".
// http://www.codeproject.com/cs/miscctrl/CsAddingBorders.asp
if (!Win32Helper.IsRunningOnMono())
{
// Get styles using Win32 calls
int style = NativeMethods.GetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_STYLE);
int exStyle = NativeMethods.GetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE);
@ -113,7 +115,7 @@ namespace WeifenLuo.WinFormsUI.Docking
// Set the styles using Win32 calls
NativeMethods.SetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_STYLE, style);
NativeMethods.SetWindowLong(MdiClient.Handle, (int)Win32.GetWindowLongIndex.GWL_EXSTYLE, exStyle);
}
// Cause an update of the non-client area.
UpdateStyles();
}
@ -232,6 +234,7 @@ namespace WeifenLuo.WinFormsUI.Docking
// If AutoScroll is set to false, hide the scrollbars when the control
// calculates its non-client area.
if (!AutoScroll)
if (!Win32Helper.IsRunningOnMono())
NativeMethods.ShowScrollBar(m.HWnd, (int)Win32.ScrollBars.SB_BOTH, 0 /*false*/);
break;
}
@ -320,6 +323,7 @@ namespace WeifenLuo.WinFormsUI.Docking
// To show style changes, the non-client area must be repainted. Using the
// control's Invalidate method does not affect the non-client area.
// Instead use a Win32 call to signal the style has changed.
if (!Win32Helper.IsRunningOnMono())
NativeMethods.SetWindowPos(MdiClient.Handle, IntPtr.Zero, 0, 0, 0, 0,
Win32.FlagsSetWindowPos.SWP_NOACTIVATE |
Win32.FlagsSetWindowPos.SWP_NOMOVE |

View File

@ -252,8 +252,11 @@ namespace WeifenLuo.WinFormsUI.Docking
xmlOut.WriteAttributeString("DockRightPortion", dockPanel.DockRightPortion.ToString(CultureInfo.InvariantCulture));
xmlOut.WriteAttributeString("DockTopPortion", dockPanel.DockTopPortion.ToString(CultureInfo.InvariantCulture));
xmlOut.WriteAttributeString("DockBottomPortion", dockPanel.DockBottomPortion.ToString(CultureInfo.InvariantCulture));
xmlOut.WriteAttributeString("ActiveDocumentPane", dockPanel.Panes.IndexOf(dockPanel.ActiveDocumentPane).ToString(CultureInfo.InvariantCulture));
xmlOut.WriteAttributeString("ActivePane", dockPanel.Panes.IndexOf(dockPanel.ActivePane).ToString(CultureInfo.InvariantCulture));
if (!Win32Helper.IsRunningOnMono())
{
xmlOut.WriteAttributeString("ActiveDocumentPane", dockPanel.Panes.IndexOf(dockPanel.ActiveDocumentPane).ToString(CultureInfo.InvariantCulture));
xmlOut.WriteAttributeString("ActivePane", dockPanel.Panes.IndexOf(dockPanel.ActivePane).ToString(CultureInfo.InvariantCulture));
}
// Contents
xmlOut.WriteStartElement("Contents");

View File

@ -170,24 +170,47 @@ namespace WeifenLuo.WinFormsUI.Docking
set { AutoHideWindow.ActiveContent = value; }
}
private bool m_allowEndUserDocking = true;
private bool m_allowEndUserDocking = !Win32Helper.IsRunningOnMono();
[LocalizedCategory("Category_Docking")]
[LocalizedDescription("DockPanel_AllowEndUserDocking_Description")]
[DefaultValue(true)]
public bool AllowEndUserDocking
{
get { return m_allowEndUserDocking; }
set { m_allowEndUserDocking = value; }
get
{
if (Win32Helper.IsRunningOnMono() && m_allowEndUserDocking)
m_allowEndUserDocking = false;
return m_allowEndUserDocking;
}
set
{
if (Win32Helper.IsRunningOnMono() && value)
throw new InvalidOperationException("AllowEndUserDocking can only be false if running on Mono");
m_allowEndUserDocking = value;
}
}
private bool m_allowEndUserNestedDocking = true;
private bool m_allowEndUserNestedDocking = !Win32Helper.IsRunningOnMono();
[LocalizedCategory("Category_Docking")]
[LocalizedDescription("DockPanel_AllowEndUserNestedDocking_Description")]
[DefaultValue(true)]
public bool AllowEndUserNestedDocking
{
get { return m_allowEndUserNestedDocking; }
set { m_allowEndUserNestedDocking = value; }
get
{
if (Win32Helper.IsRunningOnMono() && m_allowEndUserDocking)
m_allowEndUserDocking = false;
return m_allowEndUserNestedDocking;
}
set
{
if (Win32Helper.IsRunningOnMono() && value)
throw new InvalidOperationException("AllowEndUserNestedDocking can only be false if running on Mono");
m_allowEndUserNestedDocking = value;
}
}
private DockContentCollection m_contents = new DockContentCollection();
@ -1038,4 +1061,4 @@ namespace WeifenLuo.WinFormsUI.Docking
handler(this, e);
}
}
}
}

View File

@ -58,6 +58,7 @@ namespace WeifenLuo.WinFormsUI.Docking
if (bActivate)
Show();
else
if (!Win32Helper.IsRunningOnMono())
NativeMethods.ShowWindow(Handle, (int)Win32.ShowWindowStyles.SW_SHOWNOACTIVATE);
}
}

View File

@ -176,7 +176,7 @@ namespace WeifenLuo.WinFormsUI.Docking
if (IsDisposed)
return;
uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
uint result = Win32Helper.IsRunningOnMono() ? 0 : NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
if (result == 2 && DockPanel.AllowEndUserDocking && this.AllowEndUserDocking) // HITTEST_CAPTION
{
Activate();
@ -189,7 +189,7 @@ namespace WeifenLuo.WinFormsUI.Docking
}
else if (m.Msg == (int)Win32.Msgs.WM_NCRBUTTONDOWN)
{
uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
uint result = Win32Helper.IsRunningOnMono() ? 0 : NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
if (result == 2) // HITTEST_CAPTION
{
DockPane theOnlyPane = (VisibleNestedPanes.Count == 1) ? VisibleNestedPanes[0] : null;
@ -234,7 +234,7 @@ namespace WeifenLuo.WinFormsUI.Docking
}
else if (m.Msg == (int)Win32.Msgs.WM_NCLBUTTONDBLCLK)
{
uint result = NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
uint result = Win32Helper.IsRunningOnMono() ? 0: NativeMethods.SendMessage(this.Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, (uint)m.LParam);
if (result != 2) // HITTEST_CAPTION
{
base.WndProc(ref m);
@ -314,6 +314,7 @@ namespace WeifenLuo.WinFormsUI.Docking
Point ptMouse = Control.MousePosition;
uint lParam = Win32Helper.MakeLong(ptMouse.X, ptMouse.Y);
if (!Win32Helper.IsRunningOnMono())
if (NativeMethods.SendMessage(Handle, (int)Win32.Msgs.WM_NCHITTEST, 0, lParam) == (uint)Win32.HitTest.HTCAPTION)
dockOutline.Show(VisibleNestedPanes[0], -1);
}

View File

@ -74,6 +74,7 @@ namespace WeifenLuo.WinFormsUI.Docking
public static DockPane PaneAtPoint(Point pt, DockPanel dockPanel)
{
if (!Win32Helper.IsRunningOnMono())
for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
{
IDockContent content = control as IDockContent;
@ -90,6 +91,7 @@ namespace WeifenLuo.WinFormsUI.Docking
public static FloatWindow FloatWindowAtPoint(Point pt, DockPanel dockPanel)
{
if (!Win32Helper.IsRunningOnMono())
for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
{
FloatWindow floatWindow = control as FloatWindow;

View File

@ -4,16 +4,21 @@ using System.Windows.Forms;
namespace WeifenLuo.WinFormsUI.Docking
{
internal static class Win32Helper
public static class Win32Helper
{
public static Control ControlAtPoint(Point pt)
{
return Control.FromChildHandle(NativeMethods.WindowFromPoint(pt));
internal static Control ControlAtPoint(Point pt)
{
return Control.FromChildHandle(NativeMethods.WindowFromPoint(pt));
}
public static uint MakeLong(int low, int high)
internal static uint MakeLong(int low, int high)
{
return (uint)((high << 16) + low);
}
public static bool IsRunningOnMono()
{
return Type.GetType ("Mono.Runtime") != null;
}
}
}

View File

@ -56,6 +56,7 @@ namespace WeifenLuo.WinFormsUI.Docking
{
FloatWindow floatWindow = (FloatWindow)Container;
if (!floatWindow.Disposing && !floatWindow.IsDisposed)
if (!Win32Helper.IsRunningOnMono())
NativeMethods.PostMessage(((FloatWindow)Container).Handle, FloatWindow.WM_CHECKDISPOSE, 0, 0);
}
}

View File

@ -125,13 +125,13 @@
<value>Resources\DockIndicator_PaneDiamond_Bottom.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DockIndicator_PaneDiamond_Fill" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\DockIndicator_PaneDiamond_Fill.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<value>Resources\Dockindicator_PaneDiamond_Fill.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DockIndicator_PaneDiamond_HotSpot" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\DockIndicator_PaneDiamond_HotSpot.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<value>Resources\DockIndicator_PaneDiamond_Hotspot.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DockIndicator_PaneDiamond_HotSpotIndex" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\DockIndicator_PaneDiamond_HotSpotIndex.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<value>Resources\DockIndicator_PaneDiamond_HotspotIndex.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DockIndicator_PaneDiamond_Left" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\DockIndicator_PaneDiamond_Left.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@ -187,4 +187,4 @@
<data name="DockPane_OptionOverflow" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\DockPane_OptionOverflow.bmp;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
</root>

View File

@ -1,4 +1,5 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -9,9 +10,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WeifenLuo.WinFormsUI</RootNamespace>
<AssemblyName>WeifenLuo.WinFormsUI.Docking</AssemblyName>
<SignAssembly>false</SignAssembly>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>dockpanelsuite.snk</AssemblyOriginatorKeyFile>
<DelaySign>False</DelaySign>
<AssemblyOriginatorKeyMode>File</AssemblyOriginatorKeyMode>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -180,6 +182,7 @@
<None Include="Docking\Resources\DockIndicator_PanelTop_Active.bmp" />
</ItemGroup>
<ItemGroup>
<None Include="dockpanelsuite.snk" />
<None Include="license.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
@ -194,7 +197,7 @@
<ItemGroup>
<EmbeddedResource Include="Docking\DockPanel.bmp" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@ -202,4 +205,4 @@
<Target Name="AfterBuild">
</Target>
-->
</Project>
</Project>

Binary file not shown.