Make structural changes to repository
Modernizes the repository
This commit is contained in:
parent
a67593b58f
commit
7f7f8970bc
412 changed files with 72437 additions and 155552 deletions
103
source/Docking/Helpers/DockHelper.cs
Normal file
103
source/Docking/Helpers/DockHelper.cs
Normal file
|
@ -0,0 +1,103 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LSLEditor.Docking
|
||||
{
|
||||
internal static class DockHelper
|
||||
{
|
||||
public static bool IsDockStateAutoHide(DockState dockState)
|
||||
{
|
||||
if (dockState == DockState.DockLeftAutoHide ||
|
||||
dockState == DockState.DockRightAutoHide ||
|
||||
dockState == DockState.DockTopAutoHide ||
|
||||
dockState == DockState.DockBottomAutoHide)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsDockStateValid(DockState dockState, DockAreas dockableAreas)
|
||||
{
|
||||
if (((dockableAreas & DockAreas.Float) == 0) &&
|
||||
(dockState == DockState.Float))
|
||||
return false;
|
||||
else if (((dockableAreas & DockAreas.Document) == 0) &&
|
||||
(dockState == DockState.Document))
|
||||
return false;
|
||||
else if (((dockableAreas & DockAreas.DockLeft) == 0) &&
|
||||
(dockState == DockState.DockLeft || dockState == DockState.DockLeftAutoHide))
|
||||
return false;
|
||||
else if (((dockableAreas & DockAreas.DockRight) == 0) &&
|
||||
(dockState == DockState.DockRight || dockState == DockState.DockRightAutoHide))
|
||||
return false;
|
||||
else if (((dockableAreas & DockAreas.DockTop) == 0) &&
|
||||
(dockState == DockState.DockTop || dockState == DockState.DockTopAutoHide))
|
||||
return false;
|
||||
else if (((dockableAreas & DockAreas.DockBottom) == 0) &&
|
||||
(dockState == DockState.DockBottom || dockState == DockState.DockBottomAutoHide))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool IsDockWindowState(DockState state)
|
||||
{
|
||||
if (state == DockState.DockTop || state == DockState.DockBottom || state == DockState.DockLeft ||
|
||||
state == DockState.DockRight || state == DockState.Document)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
public static DockState ToggleAutoHideState(DockState state)
|
||||
{
|
||||
if (state == DockState.DockLeft)
|
||||
return DockState.DockLeftAutoHide;
|
||||
else if (state == DockState.DockRight)
|
||||
return DockState.DockRightAutoHide;
|
||||
else if (state == DockState.DockTop)
|
||||
return DockState.DockTopAutoHide;
|
||||
else if (state == DockState.DockBottom)
|
||||
return DockState.DockBottomAutoHide;
|
||||
else if (state == DockState.DockLeftAutoHide)
|
||||
return DockState.DockLeft;
|
||||
else if (state == DockState.DockRightAutoHide)
|
||||
return DockState.DockRight;
|
||||
else if (state == DockState.DockTopAutoHide)
|
||||
return DockState.DockTop;
|
||||
else if (state == DockState.DockBottomAutoHide)
|
||||
return DockState.DockBottom;
|
||||
else
|
||||
return state;
|
||||
}
|
||||
|
||||
public static DockPane PaneAtPoint(Point pt, DockPanel dockPanel)
|
||||
{
|
||||
for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
|
||||
{
|
||||
IDockContent content = control as IDockContent;
|
||||
if (content != null && content.DockHandler.DockPanel == dockPanel)
|
||||
return content.DockHandler.Pane;
|
||||
|
||||
DockPane pane = control as DockPane;
|
||||
if (pane != null && pane.DockPanel == dockPanel)
|
||||
return pane;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static FloatWindow FloatWindowAtPoint(Point pt, DockPanel dockPanel)
|
||||
{
|
||||
for (Control control = Win32Helper.ControlAtPoint(pt); control != null; control = control.Parent)
|
||||
{
|
||||
FloatWindow floatWindow = control as FloatWindow;
|
||||
if (floatWindow != null && floatWindow.DockPanel == dockPanel)
|
||||
return floatWindow;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
88
source/Docking/Helpers/DrawHelper.cs
Normal file
88
source/Docking/Helpers/DrawHelper.cs
Normal file
|
@ -0,0 +1,88 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LSLEditor.Docking
|
||||
{
|
||||
internal static class DrawHelper
|
||||
{
|
||||
public static Point RtlTransform(Control control, Point point)
|
||||
{
|
||||
if (control.RightToLeft != RightToLeft.Yes)
|
||||
return point;
|
||||
else
|
||||
return new Point(control.Right - point.X, point.Y);
|
||||
}
|
||||
|
||||
public static Rectangle RtlTransform(Control control, Rectangle rectangle)
|
||||
{
|
||||
if (control.RightToLeft != RightToLeft.Yes)
|
||||
return rectangle;
|
||||
else
|
||||
return new Rectangle(control.ClientRectangle.Right - rectangle.Right, rectangle.Y, rectangle.Width, rectangle.Height);
|
||||
}
|
||||
|
||||
public static GraphicsPath GetRoundedCornerTab(GraphicsPath graphicsPath, Rectangle rect, bool upCorner)
|
||||
{
|
||||
if (graphicsPath == null)
|
||||
graphicsPath = new GraphicsPath();
|
||||
else
|
||||
graphicsPath.Reset();
|
||||
|
||||
int curveSize = 6;
|
||||
if (upCorner)
|
||||
{
|
||||
graphicsPath.AddLine(rect.Left, rect.Bottom, rect.Left, rect.Top + curveSize / 2);
|
||||
graphicsPath.AddArc(new Rectangle(rect.Left, rect.Top, curveSize, curveSize), 180, 90);
|
||||
graphicsPath.AddLine(rect.Left + curveSize / 2, rect.Top, rect.Right - curveSize / 2, rect.Top);
|
||||
graphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Top, curveSize, curveSize), -90, 90);
|
||||
graphicsPath.AddLine(rect.Right, rect.Top + curveSize / 2, rect.Right, rect.Bottom);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphicsPath.AddLine(rect.Right, rect.Top, rect.Right, rect.Bottom - curveSize / 2);
|
||||
graphicsPath.AddArc(new Rectangle(rect.Right - curveSize, rect.Bottom - curveSize, curveSize, curveSize), 0, 90);
|
||||
graphicsPath.AddLine(rect.Right - curveSize / 2, rect.Bottom, rect.Left + curveSize / 2, rect.Bottom);
|
||||
graphicsPath.AddArc(new Rectangle(rect.Left, rect.Bottom - curveSize, curveSize, curveSize), 90, 90);
|
||||
graphicsPath.AddLine(rect.Left, rect.Bottom - curveSize / 2, rect.Left, rect.Top);
|
||||
}
|
||||
|
||||
return graphicsPath;
|
||||
}
|
||||
|
||||
public static GraphicsPath CalculateGraphicsPathFromBitmap(Bitmap bitmap)
|
||||
{
|
||||
return CalculateGraphicsPathFromBitmap(bitmap, Color.Empty);
|
||||
}
|
||||
|
||||
// From http://edu.cnzz.cn/show_3281.html
|
||||
public static GraphicsPath CalculateGraphicsPathFromBitmap(Bitmap bitmap, Color colorTransparent)
|
||||
{
|
||||
GraphicsPath graphicsPath = new GraphicsPath();
|
||||
if (colorTransparent == Color.Empty)
|
||||
colorTransparent = bitmap.GetPixel(0, 0);
|
||||
|
||||
for(int row = 0; row < bitmap.Height; row ++)
|
||||
{
|
||||
int colOpaquePixel = 0;
|
||||
for(int col = 0; col < bitmap.Width; col ++)
|
||||
{
|
||||
if(bitmap.GetPixel(col, row) != colorTransparent)
|
||||
{
|
||||
colOpaquePixel = col;
|
||||
int colNext = col;
|
||||
for(colNext = colOpaquePixel; colNext < bitmap.Width; colNext ++)
|
||||
if(bitmap.GetPixel(colNext, row) == colorTransparent)
|
||||
break;
|
||||
|
||||
graphicsPath.AddRectangle(new Rectangle(colOpaquePixel, row, colNext - colOpaquePixel, 1));
|
||||
col = colNext;
|
||||
}
|
||||
}
|
||||
}
|
||||
return graphicsPath;
|
||||
}
|
||||
}
|
||||
}
|
29
source/Docking/Helpers/ResourceHelper.cs
Normal file
29
source/Docking/Helpers/ResourceHelper.cs
Normal file
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LSLEditor.Docking
|
||||
{
|
||||
internal static class ResourceHelper
|
||||
{
|
||||
private static ResourceManager _resourceManager = null;
|
||||
|
||||
private static ResourceManager ResourceManager
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_resourceManager == null)
|
||||
_resourceManager = new ResourceManager("LSLEditor.Docking.Strings", typeof(ResourceHelper).Assembly);
|
||||
return _resourceManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static string GetString(string name)
|
||||
{
|
||||
return ResourceManager.GetString(name);
|
||||
}
|
||||
}
|
||||
}
|
19
source/Docking/Helpers/Win32Helper.cs
Normal file
19
source/Docking/Helpers/Win32Helper.cs
Normal file
|
@ -0,0 +1,19 @@
|
|||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace LSLEditor.Docking
|
||||
{
|
||||
internal static class Win32Helper
|
||||
{
|
||||
public static Control ControlAtPoint(Point pt)
|
||||
{
|
||||
return Control.FromChildHandle(NativeMethods.WindowFromPoint(pt));
|
||||
}
|
||||
|
||||
public static uint MakeLong(int low, int high)
|
||||
{
|
||||
return (uint)((high << 16) + low);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue