mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Rename variables
This commit is contained in:
parent
e96acf05d9
commit
70635461d5
15 changed files with 221 additions and 222 deletions
|
@ -40,9 +40,9 @@ public sealed class RegionCaptureForm : Form
|
|||
{
|
||||
public static GraphicsPath LastRegionFillPath { get; private set; }
|
||||
|
||||
public RegionCaptureOptions Config { get; set; }
|
||||
public Rectangle ScreenRectangle0Based { get; private set; }
|
||||
public Image Image { get; private set; }
|
||||
public RegionCaptureOptions Options { get; set; }
|
||||
public Rectangle ClientArea { get; private set; }
|
||||
public Image Canvas { get; private set; }
|
||||
public Rectangle CanvasRectangle { get; private set; }
|
||||
public RegionResult Result { get; private set; }
|
||||
public int FPS { get; private set; }
|
||||
|
@ -51,7 +51,6 @@ public sealed class RegionCaptureForm : Form
|
|||
public bool IsFullscreen { get; private set; }
|
||||
|
||||
public RegionCaptureMode Mode { get; private set; }
|
||||
|
||||
public bool IsEditorMode => Mode == RegionCaptureMode.Editor || Mode == RegionCaptureMode.TaskEditor;
|
||||
public bool IsAnnotationMode => Mode == RegionCaptureMode.Annotation || IsEditorMode;
|
||||
public bool IsAnnotated => ShapeManager != null && ShapeManager.IsAnnotated;
|
||||
|
@ -104,11 +103,11 @@ public Color CurrentColor
|
|||
public RegionCaptureForm(RegionCaptureMode mode, RegionCaptureOptions options)
|
||||
{
|
||||
Mode = mode;
|
||||
Config = options;
|
||||
IsFullscreen = !IsEditorMode || Config.EditorModeFullscreen;
|
||||
Options = options;
|
||||
IsFullscreen = !IsEditorMode || Options.EditorModeFullscreen;
|
||||
|
||||
ScreenRectangle0Based = CaptureHelpers.GetScreenBounds0Based();
|
||||
CanvasRectangle = ScreenRectangle0Based;
|
||||
ClientArea = CaptureHelpers.GetScreenBounds0Based();
|
||||
CanvasRectangle = ClientArea;
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
|
@ -160,9 +159,9 @@ private void InitializeComponent()
|
|||
FormBorderStyle = FormBorderStyle.Sizable;
|
||||
MinimumSize = new Size(800, 400);
|
||||
|
||||
if (Config.EditorModeRememberWindowState)
|
||||
if (Options.EditorModeRememberWindowState)
|
||||
{
|
||||
Config.EditorModeWindowState.ApplyFormState(this);
|
||||
Options.EditorModeWindowState.ApplyFormState(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -171,7 +170,7 @@ private void InitializeComponent()
|
|||
Bounds = new Rectangle(activeScreen.X + (activeScreen.Width / 2) - (size.Width / 2),
|
||||
activeScreen.Y + (activeScreen.Height / 2) - (size.Height / 2), size.Width, size.Height);
|
||||
|
||||
if (Config.EditorModeStartMaximized)
|
||||
if (Options.EditorModeStartMaximized)
|
||||
{
|
||||
WindowState = FormWindowState.Maximized;
|
||||
}
|
||||
|
@ -203,9 +202,9 @@ private void UpdateTitle()
|
|||
{
|
||||
text = "ShareX - " + Resources.RegionCaptureForm_InitializeComponent_ImageEditor;
|
||||
|
||||
if (Image != null)
|
||||
if (Canvas != null)
|
||||
{
|
||||
text += $" - {Image.Width}x{Image.Height}";
|
||||
text += $" - {Canvas.Width}x{Canvas.Height}";
|
||||
}
|
||||
|
||||
string filename = Helpers.GetFilenameSafe(ImageFilePath);
|
||||
|
@ -232,8 +231,8 @@ public void Prepare()
|
|||
public void Prepare(Image img)
|
||||
{
|
||||
ShapeManager = new ShapeManager(this);
|
||||
ShapeManager.WindowCaptureMode = !IsEditorMode && Config.DetectWindows;
|
||||
ShapeManager.IncludeControls = Config.DetectControls;
|
||||
ShapeManager.WindowCaptureMode = !IsEditorMode && Options.DetectWindows;
|
||||
ShapeManager.IncludeControls = Options.DetectControls;
|
||||
|
||||
InitBackground(img);
|
||||
|
||||
|
@ -253,29 +252,29 @@ public void Prepare(Image img)
|
|||
|
||||
internal void InitBackground(Image img)
|
||||
{
|
||||
if (Image != null) Image.Dispose();
|
||||
if (Canvas != null) Canvas.Dispose();
|
||||
if (backgroundBrush != null) backgroundBrush.Dispose();
|
||||
if (backgroundHighlightBrush != null) backgroundHighlightBrush.Dispose();
|
||||
|
||||
Image = img;
|
||||
Canvas = img;
|
||||
|
||||
if (IsEditorMode)
|
||||
{
|
||||
UpdateTitle();
|
||||
|
||||
CanvasRectangle = new Rectangle(CanvasRectangle.X, CanvasRectangle.Y, Image.Width, Image.Height);
|
||||
CanvasRectangle = new Rectangle(CanvasRectangle.X, CanvasRectangle.Y, Canvas.Width, Canvas.Height);
|
||||
|
||||
using (Bitmap background = new Bitmap(Image.Width, Image.Height))
|
||||
using (Bitmap background = new Bitmap(Canvas.Width, Canvas.Height))
|
||||
using (Graphics g = Graphics.FromImage(background))
|
||||
{
|
||||
Rectangle sourceRect = new Rectangle(0, 0, Image.Width, Image.Height);
|
||||
Rectangle sourceRect = new Rectangle(0, 0, Canvas.Width, Canvas.Height);
|
||||
|
||||
using (Image checkers = ImageHelpers.DrawCheckers(Image.Width, Image.Height))
|
||||
using (Image checkers = ImageHelpers.DrawCheckers(Canvas.Width, Canvas.Height))
|
||||
{
|
||||
g.DrawImage(checkers, sourceRect);
|
||||
}
|
||||
|
||||
g.DrawImage(Image, sourceRect);
|
||||
g.DrawImage(Canvas, sourceRect);
|
||||
|
||||
backgroundBrush = new TextureBrush(background) { WrapMode = WrapMode.Clamp };
|
||||
backgroundBrush.TranslateTransform(CanvasRectangle.X, CanvasRectangle.Y);
|
||||
|
@ -283,9 +282,9 @@ internal void InitBackground(Image img)
|
|||
|
||||
CenterCanvas();
|
||||
}
|
||||
else if (!IsEditorMode && Config.UseDimming)
|
||||
else if (!IsEditorMode && Options.UseDimming)
|
||||
{
|
||||
using (Bitmap darkBackground = (Bitmap)Image.Clone())
|
||||
using (Bitmap darkBackground = (Bitmap)Canvas.Clone())
|
||||
using (Graphics g = Graphics.FromImage(darkBackground))
|
||||
using (Brush brush = new SolidBrush(Color.FromArgb(30, Color.Black)))
|
||||
{
|
||||
|
@ -294,17 +293,17 @@ internal void InitBackground(Image img)
|
|||
backgroundBrush = new TextureBrush(darkBackground) { WrapMode = WrapMode.Clamp };
|
||||
}
|
||||
|
||||
backgroundHighlightBrush = new TextureBrush(Image) { WrapMode = WrapMode.Clamp };
|
||||
backgroundHighlightBrush = new TextureBrush(Canvas) { WrapMode = WrapMode.Clamp };
|
||||
}
|
||||
else
|
||||
{
|
||||
backgroundBrush = new TextureBrush(Image) { WrapMode = WrapMode.Clamp };
|
||||
backgroundBrush = new TextureBrush(Canvas) { WrapMode = WrapMode.Clamp };
|
||||
}
|
||||
|
||||
if (Config.UseCustomInfoText || Mode == RegionCaptureMode.ScreenColorPicker)
|
||||
if (Options.UseCustomInfoText || Mode == RegionCaptureMode.ScreenColorPicker)
|
||||
{
|
||||
if (bmpBackgroundImage != null) bmpBackgroundImage.Dispose();
|
||||
bmpBackgroundImage = new Bitmap(Image);
|
||||
bmpBackgroundImage = new Bitmap(Canvas);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -345,8 +344,8 @@ private void AutomaticPan(Vector2 center)
|
|||
{
|
||||
if (IsEditorMode)
|
||||
{
|
||||
int x = (int)Math.Round(ScreenRectangle0Based.Width * center.X);
|
||||
int y = (int)Math.Round(ToolbarHeight + (ScreenRectangle0Based.Height - ToolbarHeight) * center.Y);
|
||||
int x = (int)Math.Round(ClientArea.Width * center.X);
|
||||
int y = (int)Math.Round(ToolbarHeight + (ClientArea.Height - ToolbarHeight) * center.Y);
|
||||
int newX = x - CanvasRectangle.Width / 2;
|
||||
int newY = y - CanvasRectangle.Height / 2;
|
||||
int deltaX = newX - CanvasRectangle.X;
|
||||
|
@ -362,8 +361,8 @@ private void AutomaticPan()
|
|||
|
||||
private void UpdateCenterPoint()
|
||||
{
|
||||
CanvasCenterPoint = new Vector2((CanvasRectangle.X + CanvasRectangle.Width / 2f) / ScreenRectangle0Based.Width,
|
||||
(CanvasRectangle.Y + CanvasRectangle.Height / 2f) / ScreenRectangle0Based.Height);
|
||||
CanvasCenterPoint = new Vector2((CanvasRectangle.X + CanvasRectangle.Width / 2f) / ClientArea.Width,
|
||||
(CanvasRectangle.Y + CanvasRectangle.Height / 2f) / ClientArea.Height);
|
||||
}
|
||||
|
||||
public void CenterCanvas()
|
||||
|
@ -401,9 +400,9 @@ private void RegionCaptureForm_LocationChanged(object sender, EventArgs e)
|
|||
|
||||
private void RegionCaptureForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
if (IsEditorMode && Config.EditorModeRememberWindowState)
|
||||
if (IsEditorMode && Options.EditorModeRememberWindowState)
|
||||
{
|
||||
Config.EditorModeWindowState.UpdateFormState(this);
|
||||
Options.EditorModeWindowState.UpdateFormState(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -532,7 +531,7 @@ public void AddCursor(IntPtr cursorHandle, Point position)
|
|||
|
||||
private void UpdateCoordinates()
|
||||
{
|
||||
ScreenRectangle0Based = ClientRectangle;
|
||||
ClientArea = ClientRectangle;
|
||||
|
||||
InputManager.Update(this);
|
||||
}
|
||||
|
@ -557,7 +556,7 @@ private void UpdateCoordinates()
|
|||
|
||||
if (obj.Visible)
|
||||
{
|
||||
obj.IsCursorHover = obj.Rectangle.Contains(InputManager.MousePosition0Based);
|
||||
obj.IsCursorHover = obj.Rectangle.Contains(InputManager.ClientMousePosition);
|
||||
|
||||
if (obj.IsCursorHover)
|
||||
{
|
||||
|
@ -609,7 +608,7 @@ protected override void OnPaint(PaintEventArgs e)
|
|||
|
||||
Graphics g = e.Graphics;
|
||||
g.CompositingMode = CompositingMode.SourceCopy;
|
||||
if (!CanvasRectangle.Contains(ScreenRectangle0Based))
|
||||
if (!CanvasRectangle.Contains(ClientArea))
|
||||
{
|
||||
g.Clear(Color.FromArgb(14, 14, 14));
|
||||
}
|
||||
|
@ -618,7 +617,7 @@ protected override void OnPaint(PaintEventArgs e)
|
|||
|
||||
Draw(g);
|
||||
|
||||
if (Config.ShowFPS)
|
||||
if (Options.ShowFPS)
|
||||
{
|
||||
CheckFPS();
|
||||
DrawFPS(g, 10);
|
||||
|
@ -639,7 +638,7 @@ private void Draw(Graphics g)
|
|||
|
||||
if (shape != null && shape.ShapeType != ShapeType.RegionFreehand && shape.ShapeType != ShapeType.DrawingFreehand)
|
||||
{
|
||||
foreach (Size size in Config.SnapSizes)
|
||||
foreach (Size size in Options.SnapSizes)
|
||||
{
|
||||
Rectangle snapRect = CaptureHelpers.CalculateNewRectangle(shape.StartPosition, shape.EndPosition, size);
|
||||
g.DrawRectangleProper(markerPen, snapRect);
|
||||
|
@ -655,12 +654,12 @@ private void Draw(Graphics g)
|
|||
UpdateRegionPath();
|
||||
|
||||
// If background is dimmed then draw non dimmed background to region selections
|
||||
if (!IsEditorMode && Config.UseDimming)
|
||||
if (!IsEditorMode && Options.UseDimming)
|
||||
{
|
||||
using (Region region = new Region(regionDrawPath))
|
||||
{
|
||||
g.Clip = region;
|
||||
g.FillRectangle(backgroundHighlightBrush, ScreenRectangle0Based);
|
||||
g.FillRectangle(backgroundHighlightBrush, ClientArea);
|
||||
g.ResetClip();
|
||||
}
|
||||
}
|
||||
|
@ -684,7 +683,7 @@ private void Draw(Graphics g)
|
|||
// Draw animated rectangle on hover area
|
||||
if (ShapeManager.IsCurrentHoverShapeValid)
|
||||
{
|
||||
if (Config.EnableAnimations)
|
||||
if (Options.EnableAnimations)
|
||||
{
|
||||
if (!ShapeManager.PreviousHoverRectangle.IsEmpty && ShapeManager.CurrentHoverShape.Rectangle != ShapeManager.PreviousHoverRectangle)
|
||||
{
|
||||
|
@ -698,7 +697,7 @@ private void Draw(Graphics g)
|
|||
|
||||
using (GraphicsPath hoverDrawPath = new GraphicsPath { FillMode = FillMode.Winding })
|
||||
{
|
||||
if (Config.EnableAnimations && regionAnimation.IsActive && regionAnimation.CurrentRectangle.Width > 2 && regionAnimation.CurrentRectangle.Height > 2)
|
||||
if (Options.EnableAnimations && regionAnimation.IsActive && regionAnimation.CurrentRectangle.Width > 2 && regionAnimation.CurrentRectangle.Height > 2)
|
||||
{
|
||||
ShapeManager.CurrentHoverShape.OnShapePathRequested(hoverDrawPath, regionAnimation.CurrentRectangle.SizeOffset(-1));
|
||||
}
|
||||
|
@ -735,7 +734,7 @@ private void Draw(Graphics g)
|
|||
}
|
||||
|
||||
// Draw all regions rectangle info
|
||||
if (Config.ShowInfo)
|
||||
if (Options.ShowInfo)
|
||||
{
|
||||
// Add hover area to list so rectangle info can be shown
|
||||
if (ShapeManager.IsCurrentShapeTypeRegion && ShapeManager.IsCurrentHoverShapeValid && areas.All(area => area.Rectangle != ShapeManager.CurrentHoverShape.Rectangle))
|
||||
|
@ -757,19 +756,19 @@ private void Draw(Graphics g)
|
|||
DrawObjects(g);
|
||||
|
||||
// Draw F1 tips
|
||||
if (!IsEditorMode && Config.ShowHotkeys)
|
||||
if (!IsEditorMode && Options.ShowHotkeys)
|
||||
{
|
||||
DrawTips(g);
|
||||
}
|
||||
|
||||
// Draw magnifier
|
||||
if (Config.ShowMagnifier || Config.ShowInfo)
|
||||
if (Options.ShowMagnifier || Options.ShowInfo)
|
||||
{
|
||||
DrawCursorGraphics(g);
|
||||
}
|
||||
|
||||
// Draw screen wide crosshair
|
||||
if (Config.ShowCrosshair)
|
||||
if (Options.ShowCrosshair)
|
||||
{
|
||||
DrawCrosshair(g);
|
||||
}
|
||||
|
@ -854,7 +853,7 @@ private void DrawAreaText(Graphics g, string text, Rectangle area)
|
|||
Size textSize = g.MeasureString(text, infoFont).ToSize();
|
||||
Point textPos;
|
||||
|
||||
if (area.Y - offset - textSize.Height - backgroundPadding * 2 < ScreenRectangle0Based.Y)
|
||||
if (area.Y - offset - textSize.Height - backgroundPadding * 2 < ClientArea.Y)
|
||||
{
|
||||
textPos = new Point(area.X + offset + backgroundPadding, area.Y + offset + backgroundPadding);
|
||||
}
|
||||
|
@ -863,9 +862,9 @@ private void DrawAreaText(Graphics g, string text, Rectangle area)
|
|||
textPos = new Point(area.X + backgroundPadding, area.Y - offset - backgroundPadding - textSize.Height);
|
||||
}
|
||||
|
||||
if (textPos.X + textSize.Width + backgroundPadding >= ScreenRectangle0Based.Width)
|
||||
if (textPos.X + textSize.Width + backgroundPadding >= ClientArea.Width)
|
||||
{
|
||||
textPos.X = ScreenRectangle0Based.Width - textSize.Width - backgroundPadding;
|
||||
textPos.X = ClientArea.Width - textSize.Width - backgroundPadding;
|
||||
}
|
||||
|
||||
Rectangle backgroundRect = new Rectangle(textPos.X - backgroundPadding, textPos.Y - backgroundPadding, textSize.Width + backgroundPadding * 2, textSize.Height + backgroundPadding * 2);
|
||||
|
@ -887,7 +886,7 @@ private void DrawTips(Graphics g)
|
|||
Rectangle screenBounds = CaptureHelpers.GetActiveScreenBounds0Based();
|
||||
Rectangle textRectangle = new Rectangle(screenBounds.X + screenBounds.Width - rectWidth - offset, screenBounds.Y + offset, rectWidth, rectHeight);
|
||||
|
||||
if (textRectangle.Offset(10).Contains(InputManager.MousePosition0Based))
|
||||
if (textRectangle.Offset(10).Contains(InputManager.ClientMousePosition))
|
||||
{
|
||||
textRectangle.Y = screenBounds.Height - rectHeight - offset;
|
||||
}
|
||||
|
@ -929,14 +928,14 @@ private void WriteTips(StringBuilder sb)
|
|||
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Esc__Cancel_capture);
|
||||
|
||||
if (!ShapeManager.IsCreating && !Config.QuickCrop && ShapeManager.Regions.Length > 0)
|
||||
if (!ShapeManager.IsCreating && !Options.QuickCrop && ShapeManager.Regions.Length > 0)
|
||||
{
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Double_Left_click___Enter__Capture_regions);
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
|
||||
if ((!Config.QuickCrop || !ShapeManager.IsCurrentShapeTypeRegion) && ShapeManager.CurrentShape != null && !ShapeManager.IsCreating)
|
||||
if ((!Options.QuickCrop || !ShapeManager.IsCurrentShapeTypeRegion) && ShapeManager.CurrentShape != null && !ShapeManager.IsCreating)
|
||||
{
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Right_click_on_selection___Delete__Remove_region);
|
||||
sb.AppendLine(Resources.RegionCaptureForm_WriteTips_ArrowKeysResizeRegionFromBottomRightCorner);
|
||||
|
@ -956,7 +955,7 @@ private void WriteTips(StringBuilder sb)
|
|||
sb.AppendLine(Resources.RectangleRegionForm_WriteTips__Hold_Ctrl__Move_selection);
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Hold_Shift__Proportional_resizing);
|
||||
|
||||
if (ShapeManager.CurrentShapeType != ShapeType.RegionFreehand && ShapeManager.CurrentShapeType != ShapeType.DrawingFreehand)
|
||||
if (ShapeManager.CurrentTool != ShapeType.RegionFreehand && ShapeManager.CurrentTool != ShapeType.DrawingFreehand)
|
||||
{
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Hold_Alt__Snap_resizing_to_preset_sizes);
|
||||
}
|
||||
|
@ -973,7 +972,7 @@ private void WriteTips(StringBuilder sb)
|
|||
{
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Ctrl___C__Copy_position_and_size);
|
||||
}
|
||||
else if (Config.UseCustomInfoText)
|
||||
else if (Options.UseCustomInfoText)
|
||||
{
|
||||
sb.AppendLine(Resources.RectangleRegion_WriteTips__Ctrl___C__Copy_info);
|
||||
}
|
||||
|
@ -1009,35 +1008,35 @@ private void WriteTips(StringBuilder sb)
|
|||
}
|
||||
|
||||
sb.AppendLine(Resources.RectangleRegionForm_WriteTips__Ctrl___Mouse_wheel__Change_magnifier_size);
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.RegionRectangle) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.RegionRectangle) sb.Append("-> ");
|
||||
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 0", ShapeType.RegionRectangle.GetLocalizedDescription()));
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.RegionEllipse) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.RegionEllipse) sb.Append("-> ");
|
||||
sb.AppendLine(ShapeType.RegionEllipse.GetLocalizedDescription());
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.RegionFreehand) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.RegionFreehand) sb.Append("-> ");
|
||||
sb.AppendLine(ShapeType.RegionFreehand.GetLocalizedDescription());
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.DrawingRectangle) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.DrawingRectangle) sb.Append("-> ");
|
||||
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 1", ShapeType.DrawingRectangle.GetLocalizedDescription()));
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.DrawingEllipse) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.DrawingEllipse) sb.Append("-> ");
|
||||
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 2", ShapeType.DrawingEllipse.GetLocalizedDescription()));
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.DrawingFreehand) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.DrawingFreehand) sb.Append("-> ");
|
||||
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 3", ShapeType.DrawingFreehand.GetLocalizedDescription()));
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.DrawingLine) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.DrawingLine) sb.Append("-> ");
|
||||
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 4", ShapeType.DrawingLine.GetLocalizedDescription()));
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.DrawingArrow) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.DrawingArrow) sb.Append("-> ");
|
||||
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 5", ShapeType.DrawingArrow.GetLocalizedDescription()));
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.DrawingTextOutline) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.DrawingTextOutline) sb.Append("-> ");
|
||||
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 6", ShapeType.DrawingTextOutline.GetLocalizedDescription()));
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.DrawingSpeechBalloon) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.DrawingSpeechBalloon) sb.Append("-> ");
|
||||
sb.AppendLine(ShapeType.DrawingSpeechBalloon.GetLocalizedDescription());
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.DrawingStep) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.DrawingStep) sb.Append("-> ");
|
||||
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 7", ShapeType.DrawingStep.GetLocalizedDescription()));
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.DrawingImage) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.DrawingImage) sb.Append("-> ");
|
||||
sb.AppendLine(ShapeType.DrawingImage.GetLocalizedDescription());
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.EffectBlur) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.EffectBlur) sb.Append("-> ");
|
||||
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 8", ShapeType.EffectBlur.GetLocalizedDescription()));
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.EffectPixelate) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.EffectPixelate) sb.Append("-> ");
|
||||
sb.AppendLine(string.Format("[{0}] {1}", "Numpad 9", ShapeType.EffectPixelate.GetLocalizedDescription()));
|
||||
if (ShapeManager.CurrentShapeType == ShapeType.EffectHighlight) sb.Append("-> ");
|
||||
if (ShapeManager.CurrentTool == ShapeType.EffectHighlight) sb.Append("-> ");
|
||||
sb.AppendLine(ShapeType.EffectHighlight.GetLocalizedDescription());
|
||||
}
|
||||
|
||||
|
@ -1061,16 +1060,16 @@ private string GetInfoText()
|
|||
{
|
||||
if (IsEditorMode)
|
||||
{
|
||||
Point canvasRelativePosition = new Point(InputManager.MousePosition0Based.X - CanvasRectangle.X, InputManager.MousePosition0Based.Y - CanvasRectangle.Y);
|
||||
Point canvasRelativePosition = new Point(InputManager.ClientMousePosition.X - CanvasRectangle.X, InputManager.ClientMousePosition.Y - CanvasRectangle.Y);
|
||||
return $"X: {canvasRelativePosition.X} Y: {canvasRelativePosition.Y}";
|
||||
}
|
||||
else if (Mode == RegionCaptureMode.ScreenColorPicker || Config.UseCustomInfoText)
|
||||
else if (Mode == RegionCaptureMode.ScreenColorPicker || Options.UseCustomInfoText)
|
||||
{
|
||||
Color color = CurrentColor;
|
||||
|
||||
if (Mode != RegionCaptureMode.ScreenColorPicker && !string.IsNullOrEmpty(Config.CustomInfoText))
|
||||
if (Mode != RegionCaptureMode.ScreenColorPicker && !string.IsNullOrEmpty(Options.CustomInfoText))
|
||||
{
|
||||
return CodeMenuEntryPixelInfo.Parse(Config.CustomInfoText, color, CurrentPosition);
|
||||
return CodeMenuEntryPixelInfo.Parse(Options.CustomInfoText, color, CurrentPosition);
|
||||
}
|
||||
|
||||
return string.Format(Resources.RectangleRegion_GetColorPickerText, color.R, color.G, color.B, ColorHelpers.ColorToHex(color), CurrentPosition.X, CurrentPosition.Y);
|
||||
|
@ -1082,11 +1081,11 @@ private string GetInfoText()
|
|||
private void DrawCrosshair(Graphics g)
|
||||
{
|
||||
int offset = 5;
|
||||
Point mousePos = InputManager.MousePosition0Based;
|
||||
Point mousePos = InputManager.ClientMousePosition;
|
||||
Point left = new Point(mousePos.X - offset, mousePos.Y), left2 = new Point(0, mousePos.Y);
|
||||
Point right = new Point(mousePos.X + offset, mousePos.Y), right2 = new Point(ScreenRectangle0Based.Width - 1, mousePos.Y);
|
||||
Point right = new Point(mousePos.X + offset, mousePos.Y), right2 = new Point(ClientArea.Width - 1, mousePos.Y);
|
||||
Point top = new Point(mousePos.X, mousePos.Y - offset), top2 = new Point(mousePos.X, 0);
|
||||
Point bottom = new Point(mousePos.X, mousePos.Y + offset), bottom2 = new Point(mousePos.X, ScreenRectangle0Based.Height - 1);
|
||||
Point bottom = new Point(mousePos.X, mousePos.Y + offset), bottom2 = new Point(mousePos.X, ClientArea.Height - 1);
|
||||
|
||||
if (left.X - left2.X > 10)
|
||||
{
|
||||
|
@ -1115,7 +1114,7 @@ private void DrawCrosshair(Graphics g)
|
|||
|
||||
private void DrawCursorGraphics(Graphics g)
|
||||
{
|
||||
Point mousePos = InputManager.MousePosition0Based;
|
||||
Point mousePos = InputManager.ClientMousePosition;
|
||||
Rectangle currentScreenRect0Based = CaptureHelpers.GetActiveScreenBounds0Based();
|
||||
int cursorOffsetX = 10, cursorOffsetY = 10, itemGap = 10, itemCount = 0;
|
||||
Size totalSize = Size.Empty;
|
||||
|
@ -1123,12 +1122,12 @@ private void DrawCursorGraphics(Graphics g)
|
|||
int magnifierPosition = 0;
|
||||
Bitmap magnifier = null;
|
||||
|
||||
if (Config.ShowMagnifier)
|
||||
if (Options.ShowMagnifier)
|
||||
{
|
||||
if (itemCount > 0) totalSize.Height += itemGap;
|
||||
magnifierPosition = totalSize.Height;
|
||||
|
||||
magnifier = Magnifier(Image, mousePos, Config.MagnifierPixelCount, Config.MagnifierPixelCount, Config.MagnifierPixelSize);
|
||||
magnifier = Magnifier(Canvas, mousePos, Options.MagnifierPixelCount, Options.MagnifierPixelCount, Options.MagnifierPixelSize);
|
||||
totalSize.Width = Math.Max(totalSize.Width, magnifier.Width);
|
||||
|
||||
totalSize.Height += magnifier.Height;
|
||||
|
@ -1140,7 +1139,7 @@ private void DrawCursorGraphics(Graphics g)
|
|||
Rectangle infoTextRect = Rectangle.Empty;
|
||||
string infoText = "";
|
||||
|
||||
if (Config.ShowInfo)
|
||||
if (Options.ShowInfo)
|
||||
{
|
||||
if (itemCount > 0) totalSize.Height += itemGap;
|
||||
infoTextPosition = totalSize.Height;
|
||||
|
@ -1169,14 +1168,14 @@ private void DrawCursorGraphics(Graphics g)
|
|||
y = mousePos.Y - cursorOffsetY - totalSize.Height;
|
||||
}
|
||||
|
||||
if (Config.ShowMagnifier)
|
||||
if (Options.ShowMagnifier)
|
||||
{
|
||||
using (GraphicsQualityManager quality = new GraphicsQualityManager(g))
|
||||
using (TextureBrush brush = new TextureBrush(magnifier))
|
||||
{
|
||||
brush.TranslateTransform(x, y + magnifierPosition);
|
||||
|
||||
if (Config.UseSquareMagnifier)
|
||||
if (Options.UseSquareMagnifier)
|
||||
{
|
||||
g.FillRectangle(brush, x, y + magnifierPosition, magnifier.Width, magnifier.Height);
|
||||
g.DrawRectangleProper(Pens.White, x - 1, y + magnifierPosition - 1, magnifier.Width + 2, magnifier.Height + 2);
|
||||
|
@ -1191,7 +1190,7 @@ private void DrawCursorGraphics(Graphics g)
|
|||
}
|
||||
}
|
||||
|
||||
if (Config.ShowInfo)
|
||||
if (Options.ShowInfo)
|
||||
{
|
||||
infoTextRect.Location = new Point(x + (totalSize.Width / 2) - (infoTextRect.Width / 2), y + infoTextPosition);
|
||||
DrawInfoText(g, infoText, infoTextRect, infoFont, infoTextPadding);
|
||||
|
@ -1204,7 +1203,7 @@ private Bitmap Magnifier(Image img, Point position, int horizontalPixelCount, in
|
|||
verticalPixelCount = (verticalPixelCount | 1).Between(1, 101);
|
||||
pixelSize = pixelSize.Between(1, 1000);
|
||||
|
||||
if (horizontalPixelCount * pixelSize > ScreenRectangle0Based.Width || verticalPixelCount * pixelSize > ScreenRectangle0Based.Height)
|
||||
if (horizontalPixelCount * pixelSize > ClientArea.Width || verticalPixelCount * pixelSize > ClientArea.Height)
|
||||
{
|
||||
horizontalPixelCount = verticalPixelCount = 15;
|
||||
pixelSize = 10;
|
||||
|
@ -1373,7 +1372,7 @@ public Image GetResultImage()
|
|||
|
||||
private Image GetOutputImage()
|
||||
{
|
||||
return ShapeManager.RenderOutputImage(Image);
|
||||
return ShapeManager.RenderOutputImage(Canvas);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
|
@ -1412,7 +1411,7 @@ protected override void Dispose(bool disposing)
|
|||
}
|
||||
|
||||
regionDrawPath?.Dispose();
|
||||
Image?.Dispose();
|
||||
Canvas?.Dispose();
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
|
|
@ -176,7 +176,7 @@ public static Image AnnotateImage(Image img, string filePath, RegionCaptureOptio
|
|||
return form.GetResultImage();
|
||||
case RegionResult.Fullscreen: // Space or right click
|
||||
case RegionResult.AnnotateContinueTask:
|
||||
return (Image)form.Image.Clone();
|
||||
return (Image)form.Canvas.Clone();
|
||||
case RegionResult.AnnotateSaveImage:
|
||||
using (Image resultSaveImage = form.GetResultImage())
|
||||
{
|
||||
|
|
|
@ -34,11 +34,11 @@ public class InputManager
|
|||
|
||||
public Point PreviousMousePosition => oldMouseState.Position;
|
||||
|
||||
public Point MousePosition0Based => mouseState.ZeroBasedPosition;
|
||||
public Point ClientMousePosition => mouseState.ClientPosition;
|
||||
|
||||
public Point PreviousMousePosition0Based => oldMouseState.ZeroBasedPosition;
|
||||
public Point PreviousClientMousePosition => oldMouseState.ClientPosition;
|
||||
|
||||
public Point MouseVelocity => new Point(MousePosition0Based.X - PreviousMousePosition0Based.X, MousePosition0Based.Y - PreviousMousePosition0Based.Y);
|
||||
public Point MouseVelocity => new Point(ClientMousePosition.X - PreviousClientMousePosition.X, ClientMousePosition.Y - PreviousClientMousePosition.Y);
|
||||
|
||||
public bool IsMouseMoved => MouseVelocity.X != 0 || MouseVelocity.Y != 0;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ public struct MouseState
|
|||
{
|
||||
public MouseButtons Buttons { get; private set; }
|
||||
public Point Position { get; private set; }
|
||||
public Point ZeroBasedPosition { get; private set; }
|
||||
public Point ClientPosition { get; private set; }
|
||||
|
||||
public void Update(Control control)
|
||||
{
|
||||
|
@ -42,11 +42,11 @@ public void Update(Control control)
|
|||
|
||||
if (control != null)
|
||||
{
|
||||
ZeroBasedPosition = control.PointToClient(Position);
|
||||
ClientPosition = control.PointToClient(Position);
|
||||
}
|
||||
else
|
||||
{
|
||||
ZeroBasedPosition = CaptureHelpers.ScreenToClient(Position);
|
||||
ClientPosition = CaptureHelpers.ScreenToClient(Position);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,8 +78,8 @@ public Point EndPosition
|
|||
internal ShapeManager Manager { get; set; }
|
||||
|
||||
protected InputManager InputManager => Manager.InputManager;
|
||||
protected RegionCaptureOptions Options => Manager.Config;
|
||||
protected AnnotationOptions AnnotationOptions => Manager.Config.AnnotationOptions;
|
||||
protected RegionCaptureOptions Options => Manager.Options;
|
||||
protected AnnotationOptions AnnotationOptions => Manager.Options.AnnotationOptions;
|
||||
|
||||
private Point tempNodePos, tempStartPos, tempEndPos;
|
||||
|
||||
|
@ -134,7 +134,7 @@ public virtual void Resize(int x, int y, bool fromBottomRight)
|
|||
|
||||
public virtual void OnCreating()
|
||||
{
|
||||
Point pos = InputManager.MousePosition0Based;
|
||||
Point pos = InputManager.ClientMousePosition;
|
||||
|
||||
if (Options.IsFixedSize && ShapeCategory == ShapeCategory.Region)
|
||||
{
|
||||
|
@ -156,7 +156,7 @@ public virtual void OnUpdate()
|
|||
{
|
||||
if (Manager.IsCreating)
|
||||
{
|
||||
Point pos = InputManager.MousePosition0Based;
|
||||
Point pos = InputManager.ClientMousePosition;
|
||||
|
||||
if (Manager.IsCornerMoving)
|
||||
{
|
||||
|
@ -235,7 +235,7 @@ public virtual void OnNodeUpdate()
|
|||
tempEndPos = new Point(Rectangle.X + Rectangle.Width - 1, Rectangle.Y + Rectangle.Height - 1);
|
||||
}
|
||||
|
||||
Point pos = InputManager.MousePosition0Based;
|
||||
Point pos = InputManager.ClientMousePosition;
|
||||
Point startPos = tempStartPos;
|
||||
Point endPos = tempEndPos;
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ public override void OnCreating()
|
|||
{
|
||||
Manager.IsMoving = true;
|
||||
|
||||
UpdateCursor(Manager.GetSelectedCursor().Handle, InputManager.MousePosition0Based);
|
||||
UpdateCursor(Manager.GetSelectedCursor().Handle, InputManager.ClientMousePosition);
|
||||
}
|
||||
|
||||
public override void OnDraw(Graphics g)
|
||||
|
@ -70,7 +70,7 @@ public override void OnDraw(Graphics g)
|
|||
{
|
||||
g.DrawImage(cursorBitmap, Rectangle);
|
||||
|
||||
if (!Manager.IsRenderingOutput && Manager.CurrentShapeType == ShapeType.DrawingCursor)
|
||||
if (!Manager.IsRenderingOutput && Manager.CurrentTool == ShapeType.DrawingCursor)
|
||||
{
|
||||
Manager.DrawRegionArea(g, Rectangle, false);
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@ public override void OnUpdate()
|
|||
}
|
||||
else
|
||||
{
|
||||
Point pos = InputManager.MousePosition0Based;
|
||||
Point pos = InputManager.ClientMousePosition;
|
||||
|
||||
if (positions.Count == 0 || (!Manager.IsProportionalResizing && LastPosition != pos))
|
||||
{
|
||||
|
|
|
@ -106,7 +106,7 @@ protected void DrawImage(Graphics g)
|
|||
|
||||
public override void OnCreating()
|
||||
{
|
||||
StartPosition = EndPosition = InputManager.MousePosition0Based;
|
||||
StartPosition = EndPosition = InputManager.ClientMousePosition;
|
||||
|
||||
if (!OpenImageDialog(true))
|
||||
{
|
||||
|
|
|
@ -189,13 +189,13 @@ public override void OnNodeUpdate()
|
|||
{
|
||||
Manager.IsResizing = true;
|
||||
|
||||
StartPosition = InputManager.MousePosition0Based;
|
||||
StartPosition = InputManager.ClientMousePosition;
|
||||
}
|
||||
else if (Manager.ResizeNodes[1].IsDragging)
|
||||
{
|
||||
Manager.IsResizing = true;
|
||||
|
||||
EndPosition = InputManager.MousePosition0Based;
|
||||
EndPosition = InputManager.ClientMousePosition;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -207,7 +207,7 @@ public override void OnNodeUpdate()
|
|||
|
||||
Manager.IsResizing = true;
|
||||
|
||||
CenterPoints[i - 2] = InputManager.MousePosition0Based;
|
||||
CenterPoints[i - 2] = InputManager.ClientMousePosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public override void OnNodeUpdate()
|
|||
|
||||
if (TailNode.IsDragging)
|
||||
{
|
||||
TailPosition = InputManager.MousePosition0Based;
|
||||
TailPosition = InputManager.ClientMousePosition;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ public override void ShowNodes()
|
|||
public override void OnCreating()
|
||||
{
|
||||
Manager.IsMoving = true;
|
||||
Point pos = InputManager.MousePosition0Based;
|
||||
Point pos = InputManager.ClientMousePosition;
|
||||
Rectangle = new Rectangle(new Point(pos.X - Rectangle.Width / 2, pos.Y - Rectangle.Height / 2), Rectangle.Size);
|
||||
}
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ protected void DrawText(Graphics g, string text, Color textColor, TextDrawingOpt
|
|||
|
||||
public override void OnCreating()
|
||||
{
|
||||
StartPosition = EndPosition = InputManager.MousePosition0Based;
|
||||
StartPosition = EndPosition = InputManager.ClientMousePosition;
|
||||
|
||||
if (ShowTextInputBox())
|
||||
{
|
||||
|
|
|
@ -67,7 +67,7 @@ public override void OnUpdate()
|
|||
}
|
||||
else
|
||||
{
|
||||
Point pos = InputManager.MousePosition0Based;
|
||||
Point pos = InputManager.ClientMousePosition;
|
||||
|
||||
if (points.Count == 0 || (!Manager.IsProportionalResizing && LastPosition != pos))
|
||||
{
|
||||
|
|
|
@ -57,37 +57,37 @@ private set
|
|||
}
|
||||
}
|
||||
|
||||
private ShapeType currentShapeType;
|
||||
private ShapeType currentTool;
|
||||
|
||||
public ShapeType CurrentShapeType
|
||||
public ShapeType CurrentTool
|
||||
{
|
||||
get
|
||||
{
|
||||
return currentShapeType;
|
||||
return currentTool;
|
||||
}
|
||||
private set
|
||||
{
|
||||
currentShapeType = value;
|
||||
currentTool = value;
|
||||
|
||||
if (form.IsAnnotationMode)
|
||||
{
|
||||
if (IsCurrentShapeTypeRegion)
|
||||
{
|
||||
Config.LastRegionTool = CurrentShapeType;
|
||||
Options.LastRegionTool = CurrentTool;
|
||||
}
|
||||
else if (form.IsEditorMode)
|
||||
{
|
||||
Config.LastEditorTool = CurrentShapeType;
|
||||
Options.LastEditorTool = CurrentTool;
|
||||
}
|
||||
else
|
||||
{
|
||||
Config.LastAnnotationTool = CurrentShapeType;
|
||||
Options.LastAnnotationTool = CurrentTool;
|
||||
}
|
||||
}
|
||||
|
||||
DeselectCurrentShape();
|
||||
|
||||
OnCurrentShapeTypeChanged(currentShapeType);
|
||||
OnCurrentShapeTypeChanged(currentTool);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ private set
|
|||
|
||||
public bool IsCurrentHoverShapeValid => CurrentHoverShape != null && CurrentHoverShape.IsValidShape;
|
||||
|
||||
public bool IsCurrentShapeTypeRegion => IsShapeTypeRegion(CurrentShapeType);
|
||||
public bool IsCurrentShapeTypeRegion => IsShapeTypeRegion(CurrentTool);
|
||||
|
||||
public bool IsCreating { get; set; }
|
||||
public bool IsMoving { get; set; }
|
||||
|
@ -164,9 +164,9 @@ private set
|
|||
public bool WindowCaptureMode { get; set; }
|
||||
public bool IncludeControls { get; set; }
|
||||
|
||||
public RegionCaptureOptions Config { get; private set; }
|
||||
public RegionCaptureOptions Options { get; private set; }
|
||||
|
||||
public AnnotationOptions AnnotationOptions => Config.AnnotationOptions;
|
||||
public AnnotationOptions AnnotationOptions => Options.AnnotationOptions;
|
||||
|
||||
public List<ResizeNode> ResizeNodes { get; private set; }
|
||||
|
||||
|
@ -214,7 +214,7 @@ public bool NodesVisible
|
|||
public ShapeManager(RegionCaptureForm form)
|
||||
{
|
||||
this.form = form;
|
||||
Config = form.Config;
|
||||
Options = form.Options;
|
||||
|
||||
ResizeNodes = new List<ResizeNode>();
|
||||
|
||||
|
@ -241,15 +241,15 @@ public ShapeManager(RegionCaptureForm form)
|
|||
|
||||
if (form.Mode == RegionCaptureMode.Annotation)
|
||||
{
|
||||
CurrentShapeType = Config.LastRegionTool;
|
||||
CurrentTool = Options.LastRegionTool;
|
||||
}
|
||||
else if (form.IsEditorMode)
|
||||
{
|
||||
CurrentShapeType = Config.LastEditorTool;
|
||||
CurrentTool = Options.LastEditorTool;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentShapeType = ShapeType.RegionRectangle;
|
||||
CurrentTool = ShapeType.RegionRectangle;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ private void form_MouseUp(object sender, MouseEventArgs e)
|
|||
}
|
||||
else if (form.IsAnnotationMode)
|
||||
{
|
||||
RunAction(Config.RegionCaptureActionRightClick);
|
||||
RunAction(Options.RegionCaptureActionRightClick);
|
||||
}
|
||||
else if (IsShapeIntersect())
|
||||
{
|
||||
|
@ -321,16 +321,16 @@ private void form_MouseUp(object sender, MouseEventArgs e)
|
|||
}
|
||||
else
|
||||
{
|
||||
RunAction(Config.RegionCaptureActionMiddleClick);
|
||||
RunAction(Options.RegionCaptureActionMiddleClick);
|
||||
}
|
||||
}
|
||||
else if (e.Button == MouseButtons.XButton1)
|
||||
{
|
||||
RunAction(Config.RegionCaptureActionX1Click);
|
||||
RunAction(Options.RegionCaptureActionX1Click);
|
||||
}
|
||||
else if (e.Button == MouseButtons.XButton2)
|
||||
{
|
||||
RunAction(Config.RegionCaptureActionX2Click);
|
||||
RunAction(Options.RegionCaptureActionX2Click);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -356,22 +356,22 @@ private void form_MouseWheel(object sender, MouseEventArgs e)
|
|||
{
|
||||
if (e.Delta > 0)
|
||||
{
|
||||
CurrentShapeType = CurrentShapeType.Previous<ShapeType>();
|
||||
CurrentTool = CurrentTool.Previous<ShapeType>();
|
||||
}
|
||||
else if (e.Delta < 0)
|
||||
{
|
||||
CurrentShapeType = CurrentShapeType.Next<ShapeType>();
|
||||
CurrentTool = CurrentTool.Next<ShapeType>();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (e.Delta > 0)
|
||||
{
|
||||
Config.MagnifierPixelCount = Math.Min(Config.MagnifierPixelCount + 2, RegionCaptureOptions.MagnifierPixelCountMaximum);
|
||||
Options.MagnifierPixelCount = Math.Min(Options.MagnifierPixelCount + 2, RegionCaptureOptions.MagnifierPixelCountMaximum);
|
||||
}
|
||||
else if (e.Delta < 0)
|
||||
{
|
||||
Config.MagnifierPixelCount = Math.Max(Config.MagnifierPixelCount - 2, RegionCaptureOptions.MagnifierPixelCountMinimum);
|
||||
Options.MagnifierPixelCount = Math.Max(Options.MagnifierPixelCount - 2, RegionCaptureOptions.MagnifierPixelCountMinimum);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -431,9 +431,9 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
|||
DeleteAllShapes();
|
||||
break;
|
||||
case Keys.F1:
|
||||
Config.ShowHotkeys = !Config.ShowHotkeys;
|
||||
Options.ShowHotkeys = !Options.ShowHotkeys;
|
||||
if (tsmiTips != null)
|
||||
tsmiTips.Checked = Config.ShowHotkeys;
|
||||
tsmiTips.Checked = Options.ShowHotkeys;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,7 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
|||
SwapShapeType();
|
||||
break;
|
||||
case Keys.NumPad0:
|
||||
CurrentShapeType = ShapeType.RegionRectangle;
|
||||
CurrentTool = ShapeType.RegionRectangle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -457,31 +457,31 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
|||
switch (e.KeyData)
|
||||
{
|
||||
case Keys.NumPad1:
|
||||
CurrentShapeType = ShapeType.DrawingRectangle;
|
||||
CurrentTool = ShapeType.DrawingRectangle;
|
||||
break;
|
||||
case Keys.NumPad2:
|
||||
CurrentShapeType = ShapeType.DrawingEllipse;
|
||||
CurrentTool = ShapeType.DrawingEllipse;
|
||||
break;
|
||||
case Keys.NumPad3:
|
||||
CurrentShapeType = ShapeType.DrawingFreehand;
|
||||
CurrentTool = ShapeType.DrawingFreehand;
|
||||
break;
|
||||
case Keys.NumPad4:
|
||||
CurrentShapeType = ShapeType.DrawingLine;
|
||||
CurrentTool = ShapeType.DrawingLine;
|
||||
break;
|
||||
case Keys.NumPad5:
|
||||
CurrentShapeType = ShapeType.DrawingArrow;
|
||||
CurrentTool = ShapeType.DrawingArrow;
|
||||
break;
|
||||
case Keys.NumPad6:
|
||||
CurrentShapeType = ShapeType.DrawingTextOutline;
|
||||
CurrentTool = ShapeType.DrawingTextOutline;
|
||||
break;
|
||||
case Keys.NumPad7:
|
||||
CurrentShapeType = ShapeType.DrawingStep;
|
||||
CurrentTool = ShapeType.DrawingStep;
|
||||
break;
|
||||
case Keys.NumPad8:
|
||||
CurrentShapeType = ShapeType.EffectBlur;
|
||||
CurrentTool = ShapeType.EffectBlur;
|
||||
break;
|
||||
case Keys.NumPad9:
|
||||
CurrentShapeType = ShapeType.EffectPixelate;
|
||||
CurrentTool = ShapeType.EffectPixelate;
|
||||
break;
|
||||
case Keys.Control | Keys.V:
|
||||
PasteFromClipboard();
|
||||
|
@ -502,8 +502,8 @@ private void form_KeyDown(object sender, KeyEventArgs e)
|
|||
MoveCurrentShapeDown();
|
||||
break;
|
||||
case Keys.Q:
|
||||
Config.QuickCrop = !Config.QuickCrop;
|
||||
tsmiQuickCrop.Checked = !Config.QuickCrop;
|
||||
Options.QuickCrop = !Options.QuickCrop;
|
||||
tsmiQuickCrop.Checked = !Options.QuickCrop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ private void StartRegionSelection()
|
|||
|
||||
BaseShape shape = GetIntersectShape();
|
||||
|
||||
if (shape != null && shape.ShapeType == CurrentShapeType) // Select shape
|
||||
if (shape != null && shape.ShapeType == CurrentTool) // Select shape
|
||||
{
|
||||
IsMoving = true;
|
||||
form.Cursor = Cursors.SizeAll;
|
||||
|
@ -715,7 +715,7 @@ private void EndRegionSelection()
|
|||
|
||||
if (shape != null)
|
||||
{
|
||||
if (Config.QuickCrop && IsCurrentShapeTypeRegion)
|
||||
if (Options.QuickCrop && IsCurrentShapeTypeRegion)
|
||||
{
|
||||
form.UpdateRegionPath();
|
||||
form.Close(RegionResult.Region);
|
||||
|
@ -762,7 +762,7 @@ private void AddShape(BaseShape shape)
|
|||
|
||||
private BaseShape CreateShape()
|
||||
{
|
||||
return CreateShape(CurrentShapeType);
|
||||
return CreateShape(CurrentTool);
|
||||
}
|
||||
|
||||
private BaseShape CreateShape(ShapeType shapeType)
|
||||
|
@ -854,11 +854,11 @@ private void SwapShapeType()
|
|||
{
|
||||
if (IsCurrentShapeTypeRegion)
|
||||
{
|
||||
CurrentShapeType = Config.LastAnnotationTool;
|
||||
CurrentTool = Options.LastAnnotationTool;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentShapeType = Config.LastRegionTool;
|
||||
CurrentTool = Options.LastRegionTool;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -868,7 +868,7 @@ public Point SnapPosition(Point posOnClick, Point posCurrent)
|
|||
Size currentSize = CaptureHelpers.CreateRectangle(posOnClick, posCurrent).Size;
|
||||
Vector2 vector = new Vector2(currentSize.Width, currentSize.Height);
|
||||
|
||||
SnapSize snapSize = (from size in Config.SnapSizes
|
||||
SnapSize snapSize = (from size in Options.SnapSizes
|
||||
let distance = MathHelpers.Distance(vector, new Vector2(size.Width, size.Height))
|
||||
where distance > 0 && distance < RegionCaptureOptions.SnapDistance
|
||||
orderby distance
|
||||
|
@ -880,7 +880,7 @@ orderby distance
|
|||
|
||||
Rectangle newRect = CaptureHelpers.CreateRectangle(posOnClick, posNew);
|
||||
|
||||
if (form.ScreenRectangle0Based.Contains(newRect))
|
||||
if (form.ClientArea.Contains(newRect))
|
||||
{
|
||||
return posNew;
|
||||
}
|
||||
|
@ -906,7 +906,7 @@ private BaseShape CheckHover()
|
|||
}
|
||||
else
|
||||
{
|
||||
switch (CurrentShapeType)
|
||||
switch (CurrentTool)
|
||||
{
|
||||
case ShapeType.RegionFreehand:
|
||||
case ShapeType.DrawingFreehand:
|
||||
|
@ -921,13 +921,13 @@ private BaseShape CheckHover()
|
|||
return null;
|
||||
}
|
||||
|
||||
if (Config.IsFixedSize && IsCurrentShapeTypeRegion)
|
||||
if (Options.IsFixedSize && IsCurrentShapeTypeRegion)
|
||||
{
|
||||
Point location = InputManager.MousePosition0Based;
|
||||
Point location = InputManager.ClientMousePosition;
|
||||
|
||||
return new RectangleRegionShape()
|
||||
{
|
||||
Rectangle = new Rectangle(new Point(location.X - Config.FixedSize.Width / 2, location.Y - Config.FixedSize.Height / 2), Config.FixedSize)
|
||||
Rectangle = new Rectangle(new Point(location.X - Options.FixedSize.Width / 2, location.Y - Options.FixedSize.Height / 2), Options.FixedSize)
|
||||
};
|
||||
}
|
||||
else
|
||||
|
@ -940,7 +940,7 @@ private BaseShape CheckHover()
|
|||
|
||||
return new RectangleRegionShape()
|
||||
{
|
||||
Rectangle = Rectangle.Intersect(form.ScreenRectangle0Based, hoverArea)
|
||||
Rectangle = Rectangle.Intersect(form.ClientArea, hoverArea)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -1080,7 +1080,7 @@ private void DeleteAllShapes()
|
|||
|
||||
public BaseShape GetIntersectShape()
|
||||
{
|
||||
return GetIntersectShape(InputManager.MousePosition0Based);
|
||||
return GetIntersectShape(InputManager.ClientMousePosition);
|
||||
}
|
||||
|
||||
public BaseShape GetIntersectShape(Point position)
|
||||
|
@ -1089,7 +1089,7 @@ public BaseShape GetIntersectShape(Point position)
|
|||
{
|
||||
BaseShape shape = Shapes[i];
|
||||
|
||||
if (shape.ShapeType == CurrentShapeType && shape.Intersects(position))
|
||||
if (shape.ShapeType == CurrentTool && shape.Intersects(position))
|
||||
{
|
||||
return shape;
|
||||
}
|
||||
|
@ -1275,9 +1275,9 @@ private void PasteFromClipboard()
|
|||
|
||||
if (img != null)
|
||||
{
|
||||
CurrentShapeType = ShapeType.DrawingImage;
|
||||
CurrentTool = ShapeType.DrawingImage;
|
||||
ImageDrawingShape shape = (ImageDrawingShape)CreateShape(ShapeType.DrawingImage);
|
||||
shape.StartPosition = shape.EndPosition = InputManager.MousePosition0Based;
|
||||
shape.StartPosition = shape.EndPosition = InputManager.ClientMousePosition;
|
||||
shape.SetImage(img, true);
|
||||
AddShape(shape);
|
||||
SelectCurrentShape();
|
||||
|
@ -1289,9 +1289,9 @@ private void PasteFromClipboard()
|
|||
|
||||
if (!string.IsNullOrEmpty(text))
|
||||
{
|
||||
CurrentShapeType = ShapeType.DrawingTextBackground;
|
||||
CurrentTool = ShapeType.DrawingTextBackground;
|
||||
TextDrawingShape shape = (TextDrawingShape)CreateShape(ShapeType.DrawingTextBackground);
|
||||
shape.StartPosition = shape.EndPosition = InputManager.MousePosition0Based;
|
||||
shape.StartPosition = shape.EndPosition = InputManager.ClientMousePosition;
|
||||
shape.Text = text.Trim();
|
||||
shape.AutoSize(true);
|
||||
AddShape(shape);
|
||||
|
@ -1338,11 +1338,11 @@ public Image CropImage(Rectangle rect, bool onlyIfSizeDifferent = false)
|
|||
rect.X -= offset.X;
|
||||
rect.Y -= offset.Y;
|
||||
|
||||
rect.Intersect(new Rectangle(0, 0, form.Image.Width, form.Image.Height));
|
||||
rect.Intersect(new Rectangle(0, 0, form.Canvas.Width, form.Canvas.Height));
|
||||
|
||||
if (rect.IsValid() && (!onlyIfSizeDifferent || rect.Size != form.Image.Size))
|
||||
if (rect.IsValid() && (!onlyIfSizeDifferent || rect.Size != form.Canvas.Size))
|
||||
{
|
||||
return ImageHelpers.CropImage(form.Image, rect);
|
||||
return ImageHelpers.CropImage(form.Canvas, rect);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -1350,7 +1350,7 @@ public Image CropImage(Rectangle rect, bool onlyIfSizeDifferent = false)
|
|||
|
||||
private void ChangeImageSize()
|
||||
{
|
||||
Size oldSize = form.Image.Size;
|
||||
Size oldSize = form.Canvas.Size;
|
||||
|
||||
using (ImageSizeForm imageSizeForm = new ImageSizeForm(oldSize))
|
||||
{
|
||||
|
@ -1360,7 +1360,7 @@ private void ChangeImageSize()
|
|||
|
||||
if (size != oldSize)
|
||||
{
|
||||
Image img = ImageHelpers.ResizeImage(form.Image, size);
|
||||
Image img = ImageHelpers.ResizeImage(form.Canvas, size);
|
||||
|
||||
if (img != null)
|
||||
{
|
||||
|
@ -1379,7 +1379,7 @@ private void ChangeCanvasSize()
|
|||
if (canvasSizeForm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
Padding canvas = canvasSizeForm.Canvas;
|
||||
Image img = ImageHelpers.AddCanvas(form.Image, canvas);
|
||||
Image img = ImageHelpers.AddCanvas(form.Canvas, canvas);
|
||||
|
||||
if (img != null)
|
||||
{
|
||||
|
@ -1393,7 +1393,7 @@ private void ChangeCanvasSize()
|
|||
|
||||
private void RotateImage(RotateFlipType type)
|
||||
{
|
||||
Image clone = (Image)form.Image.Clone();
|
||||
Image clone = (Image)form.Canvas.Clone();
|
||||
clone.RotateFlip(type);
|
||||
form.InitBackground(clone);
|
||||
isAnnotated = true;
|
||||
|
|
|
@ -288,13 +288,13 @@ internal void CreateToolbar()
|
|||
}
|
||||
|
||||
tsbShapeType.Image = img;
|
||||
tsbShapeType.Checked = shapeType == CurrentShapeType;
|
||||
tsbShapeType.Checked = shapeType == CurrentTool;
|
||||
tsbShapeType.Tag = shapeType;
|
||||
|
||||
tsbShapeType.MouseDown += (sender, e) =>
|
||||
{
|
||||
tsbShapeType.RadioCheck();
|
||||
CurrentShapeType = shapeType;
|
||||
CurrentTool = shapeType;
|
||||
};
|
||||
|
||||
tsMain.Items.Add(tsbShapeType);
|
||||
|
@ -312,7 +312,7 @@ internal void CreateToolbar()
|
|||
{
|
||||
PauseForm();
|
||||
|
||||
ShapeType shapeType = CurrentShapeType;
|
||||
ShapeType shapeType = CurrentTool;
|
||||
|
||||
Color borderColor;
|
||||
|
||||
|
@ -366,7 +366,7 @@ internal void CreateToolbar()
|
|||
{
|
||||
PauseForm();
|
||||
|
||||
ShapeType shapeType = CurrentShapeType;
|
||||
ShapeType shapeType = CurrentTool;
|
||||
|
||||
Color fillColor;
|
||||
|
||||
|
@ -433,7 +433,7 @@ internal void CreateToolbar()
|
|||
tslnudBorderSize.Content.Maximum = 20;
|
||||
tslnudBorderSize.Content.ValueChanged = (sender, e) =>
|
||||
{
|
||||
ShapeType shapeType = CurrentShapeType;
|
||||
ShapeType shapeType = CurrentTool;
|
||||
|
||||
int borderSize = (int)tslnudBorderSize.Content.Value;
|
||||
|
||||
|
@ -463,7 +463,7 @@ internal void CreateToolbar()
|
|||
tslnudCornerRadius.Content.Maximum = 150;
|
||||
tslnudCornerRadius.Content.ValueChanged = (sender, e) =>
|
||||
{
|
||||
ShapeType shapeType = CurrentShapeType;
|
||||
ShapeType shapeType = CurrentTool;
|
||||
|
||||
if (shapeType == ShapeType.RegionRectangle)
|
||||
{
|
||||
|
@ -724,21 +724,21 @@ internal void CreateToolbar()
|
|||
if (form.IsEditorMode)
|
||||
{
|
||||
ToolStripMenuItem tsmiEditorModeStartMaximized = new ToolStripMenuItem(Resources.ShapeManager_CreateToolbar_StartEditorMaximized);
|
||||
tsmiEditorModeStartMaximized.Checked = Config.EditorModeStartMaximized;
|
||||
tsmiEditorModeStartMaximized.Checked = Options.EditorModeStartMaximized;
|
||||
tsmiEditorModeStartMaximized.CheckOnClick = true;
|
||||
tsmiEditorModeStartMaximized.Click += (sender, e) => Config.EditorModeStartMaximized = tsmiEditorModeStartMaximized.Checked;
|
||||
tsmiEditorModeStartMaximized.Click += (sender, e) => Options.EditorModeStartMaximized = tsmiEditorModeStartMaximized.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiEditorModeStartMaximized);
|
||||
|
||||
ToolStripMenuItem tsmiEditorModeRememberWindowState = new ToolStripMenuItem(Resources.ShapeManager_CreateToolbar_RememberEditorWindowState);
|
||||
tsmiEditorModeRememberWindowState.Checked = Config.EditorModeRememberWindowState;
|
||||
tsmiEditorModeRememberWindowState.Checked = Options.EditorModeRememberWindowState;
|
||||
tsmiEditorModeRememberWindowState.CheckOnClick = true;
|
||||
tsmiEditorModeRememberWindowState.Click += (sender, e) => Config.EditorModeRememberWindowState = tsmiEditorModeRememberWindowState.Checked;
|
||||
tsmiEditorModeRememberWindowState.Click += (sender, e) => Options.EditorModeRememberWindowState = tsmiEditorModeRememberWindowState.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiEditorModeRememberWindowState);
|
||||
|
||||
ToolStripMenuItem tsmiEditorModeFullscreen = new ToolStripMenuItem(Resources.ShapeManager_CreateToolbar_StartEditorFullscreen);
|
||||
tsmiEditorModeFullscreen.Checked = Config.EditorModeFullscreen;
|
||||
tsmiEditorModeFullscreen.Checked = Options.EditorModeFullscreen;
|
||||
tsmiEditorModeFullscreen.CheckOnClick = true;
|
||||
tsmiEditorModeFullscreen.Click += (sender, e) => Config.EditorModeFullscreen = tsmiEditorModeFullscreen.Checked;
|
||||
tsmiEditorModeFullscreen.Click += (sender, e) => Options.EditorModeFullscreen = tsmiEditorModeFullscreen.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiEditorModeFullscreen);
|
||||
|
||||
tsddbOptions.DropDownItems.Add(new ToolStripSeparator());
|
||||
|
@ -747,71 +747,71 @@ internal void CreateToolbar()
|
|||
if (!form.IsEditorMode)
|
||||
{
|
||||
tsmiQuickCrop = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Multi_region_mode);
|
||||
tsmiQuickCrop.Checked = !Config.QuickCrop;
|
||||
tsmiQuickCrop.Checked = !Options.QuickCrop;
|
||||
tsmiQuickCrop.CheckOnClick = true;
|
||||
tsmiQuickCrop.ShortcutKeyDisplayString = "Q";
|
||||
tsmiQuickCrop.Click += (sender, e) => Config.QuickCrop = !tsmiQuickCrop.Checked;
|
||||
tsmiQuickCrop.Click += (sender, e) => Options.QuickCrop = !tsmiQuickCrop.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiQuickCrop);
|
||||
|
||||
tsmiTips = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Show_tips);
|
||||
tsmiTips.Checked = Config.ShowHotkeys;
|
||||
tsmiTips.Checked = Options.ShowHotkeys;
|
||||
tsmiTips.CheckOnClick = true;
|
||||
tsmiTips.ShortcutKeyDisplayString = "F1";
|
||||
tsmiTips.Click += (sender, e) => Config.ShowHotkeys = tsmiTips.Checked;
|
||||
tsmiTips.Click += (sender, e) => Options.ShowHotkeys = tsmiTips.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiTips);
|
||||
}
|
||||
|
||||
ToolStripMenuItem tsmiShowInfo = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Show_position_and_size_info);
|
||||
tsmiShowInfo.Checked = Config.ShowInfo;
|
||||
tsmiShowInfo.Checked = Options.ShowInfo;
|
||||
tsmiShowInfo.CheckOnClick = true;
|
||||
tsmiShowInfo.Click += (sender, e) => Config.ShowInfo = tsmiShowInfo.Checked;
|
||||
tsmiShowInfo.Click += (sender, e) => Options.ShowInfo = tsmiShowInfo.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiShowInfo);
|
||||
|
||||
ToolStripMenuItem tsmiShowMagnifier = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Show_magnifier);
|
||||
tsmiShowMagnifier.Checked = Config.ShowMagnifier;
|
||||
tsmiShowMagnifier.Checked = Options.ShowMagnifier;
|
||||
tsmiShowMagnifier.CheckOnClick = true;
|
||||
tsmiShowMagnifier.Click += (sender, e) => Config.ShowMagnifier = tsmiShowMagnifier.Checked;
|
||||
tsmiShowMagnifier.Click += (sender, e) => Options.ShowMagnifier = tsmiShowMagnifier.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiShowMagnifier);
|
||||
|
||||
ToolStripMenuItem tsmiUseSquareMagnifier = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Square_shape_magnifier);
|
||||
tsmiUseSquareMagnifier.Checked = Config.UseSquareMagnifier;
|
||||
tsmiUseSquareMagnifier.Checked = Options.UseSquareMagnifier;
|
||||
tsmiUseSquareMagnifier.CheckOnClick = true;
|
||||
tsmiUseSquareMagnifier.Click += (sender, e) => Config.UseSquareMagnifier = tsmiUseSquareMagnifier.Checked;
|
||||
tsmiUseSquareMagnifier.Click += (sender, e) => Options.UseSquareMagnifier = tsmiUseSquareMagnifier.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiUseSquareMagnifier);
|
||||
|
||||
ToolStripLabeledNumericUpDown tslnudMagnifierPixelCount = new ToolStripLabeledNumericUpDown(Resources.ShapeManager_CreateContextMenu_Magnifier_pixel_count_);
|
||||
tslnudMagnifierPixelCount.Content.Minimum = RegionCaptureOptions.MagnifierPixelCountMinimum;
|
||||
tslnudMagnifierPixelCount.Content.Maximum = RegionCaptureOptions.MagnifierPixelCountMaximum;
|
||||
tslnudMagnifierPixelCount.Content.Increment = 2;
|
||||
tslnudMagnifierPixelCount.Content.Value = Config.MagnifierPixelCount;
|
||||
tslnudMagnifierPixelCount.Content.ValueChanged = (sender, e) => Config.MagnifierPixelCount = (int)tslnudMagnifierPixelCount.Content.Value;
|
||||
tslnudMagnifierPixelCount.Content.Value = Options.MagnifierPixelCount;
|
||||
tslnudMagnifierPixelCount.Content.ValueChanged = (sender, e) => Options.MagnifierPixelCount = (int)tslnudMagnifierPixelCount.Content.Value;
|
||||
tsddbOptions.DropDownItems.Add(tslnudMagnifierPixelCount);
|
||||
|
||||
ToolStripLabeledNumericUpDown tslnudMagnifierPixelSize = new ToolStripLabeledNumericUpDown(Resources.ShapeManager_CreateContextMenu_Magnifier_pixel_size_);
|
||||
tslnudMagnifierPixelSize.Content.Minimum = RegionCaptureOptions.MagnifierPixelSizeMinimum;
|
||||
tslnudMagnifierPixelSize.Content.Maximum = RegionCaptureOptions.MagnifierPixelSizeMaximum;
|
||||
tslnudMagnifierPixelSize.Content.Value = Config.MagnifierPixelSize;
|
||||
tslnudMagnifierPixelSize.Content.ValueChanged = (sender, e) => Config.MagnifierPixelSize = (int)tslnudMagnifierPixelSize.Content.Value;
|
||||
tslnudMagnifierPixelSize.Content.Value = Options.MagnifierPixelSize;
|
||||
tslnudMagnifierPixelSize.Content.ValueChanged = (sender, e) => Options.MagnifierPixelSize = (int)tslnudMagnifierPixelSize.Content.Value;
|
||||
tsddbOptions.DropDownItems.Add(tslnudMagnifierPixelSize);
|
||||
|
||||
ToolStripMenuItem tsmiShowCrosshair = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Show_screen_wide_crosshair);
|
||||
tsmiShowCrosshair.Checked = Config.ShowCrosshair;
|
||||
tsmiShowCrosshair.Checked = Options.ShowCrosshair;
|
||||
tsmiShowCrosshair.CheckOnClick = true;
|
||||
tsmiShowCrosshair.Click += (sender, e) => Config.ShowCrosshair = tsmiShowCrosshair.Checked;
|
||||
tsmiShowCrosshair.Click += (sender, e) => Options.ShowCrosshair = tsmiShowCrosshair.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiShowCrosshair);
|
||||
|
||||
ToolStripMenuItem tsmiEnableAnimations = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_EnableAnimations);
|
||||
tsmiEnableAnimations.Checked = Config.EnableAnimations;
|
||||
tsmiEnableAnimations.Checked = Options.EnableAnimations;
|
||||
tsmiEnableAnimations.CheckOnClick = true;
|
||||
tsmiEnableAnimations.Click += (sender, e) => Config.EnableAnimations = tsmiEnableAnimations.Checked;
|
||||
tsmiEnableAnimations.Click += (sender, e) => Options.EnableAnimations = tsmiEnableAnimations.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiEnableAnimations);
|
||||
|
||||
if (!form.IsEditorMode)
|
||||
{
|
||||
ToolStripMenuItem tsmiFixedSize = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Fixed_size_region_mode);
|
||||
tsmiFixedSize.Checked = Config.IsFixedSize;
|
||||
tsmiFixedSize.Checked = Options.IsFixedSize;
|
||||
tsmiFixedSize.CheckOnClick = true;
|
||||
tsmiFixedSize.Click += (sender, e) => Config.IsFixedSize = tsmiFixedSize.Checked;
|
||||
tsmiFixedSize.Click += (sender, e) => Options.IsFixedSize = tsmiFixedSize.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiFixedSize);
|
||||
|
||||
ToolStripDoubleLabeledNumericUpDown tslnudFixedSize = new ToolStripDoubleLabeledNumericUpDown(Resources.ShapeManager_CreateContextMenu_Width_,
|
||||
|
@ -819,24 +819,24 @@ internal void CreateToolbar()
|
|||
tslnudFixedSize.Content.Minimum = 10;
|
||||
tslnudFixedSize.Content.Maximum = 10000;
|
||||
tslnudFixedSize.Content.Increment = 10;
|
||||
tslnudFixedSize.Content.Value = Config.FixedSize.Width;
|
||||
tslnudFixedSize.Content.Value2 = Config.FixedSize.Height;
|
||||
tslnudFixedSize.Content.ValueChanged = (sender, e) => Config.FixedSize = new Size((int)tslnudFixedSize.Content.Value, (int)tslnudFixedSize.Content.Value2);
|
||||
tslnudFixedSize.Content.Value = Options.FixedSize.Width;
|
||||
tslnudFixedSize.Content.Value2 = Options.FixedSize.Height;
|
||||
tslnudFixedSize.Content.ValueChanged = (sender, e) => Options.FixedSize = new Size((int)tslnudFixedSize.Content.Value, (int)tslnudFixedSize.Content.Value2);
|
||||
tsddbOptions.DropDownItems.Add(tslnudFixedSize);
|
||||
}
|
||||
|
||||
ToolStripMenuItem tsmiShowFPS = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_Show_FPS);
|
||||
tsmiShowFPS.Checked = Config.ShowFPS;
|
||||
tsmiShowFPS.Checked = Options.ShowFPS;
|
||||
tsmiShowFPS.CheckOnClick = true;
|
||||
tsmiShowFPS.Click += (sender, e) => Config.ShowFPS = tsmiShowFPS.Checked;
|
||||
tsmiShowFPS.Click += (sender, e) => Options.ShowFPS = tsmiShowFPS.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiShowFPS);
|
||||
|
||||
if (!form.IsEditorMode)
|
||||
{
|
||||
ToolStripMenuItem tsmiRememberMenuState = new ToolStripMenuItem(Resources.ShapeManager_CreateContextMenu_RememberMenuState);
|
||||
tsmiRememberMenuState.Checked = Config.RememberMenuState;
|
||||
tsmiRememberMenuState.Checked = Options.RememberMenuState;
|
||||
tsmiRememberMenuState.CheckOnClick = true;
|
||||
tsmiRememberMenuState.Click += (sender, e) => Config.RememberMenuState = tsmiRememberMenuState.Checked;
|
||||
tsmiRememberMenuState.Click += (sender, e) => Options.RememberMenuState = tsmiRememberMenuState.Checked;
|
||||
tsddbOptions.DropDownItems.Add(tsmiRememberMenuState);
|
||||
}
|
||||
|
||||
|
@ -958,9 +958,9 @@ private void TslDrag_MouseDown(object sender, MouseEventArgs e)
|
|||
|
||||
private void ConfigureMenuState()
|
||||
{
|
||||
if (!form.IsEditorMode && Config.RememberMenuState)
|
||||
if (!form.IsEditorMode && Options.RememberMenuState)
|
||||
{
|
||||
SetMenuCollapsed(Config.MenuCollapsed);
|
||||
SetMenuCollapsed(Options.MenuCollapsed);
|
||||
}
|
||||
|
||||
UpdateMenuPosition();
|
||||
|
@ -977,12 +977,12 @@ internal void UpdateMenuPosition()
|
|||
}
|
||||
else
|
||||
{
|
||||
rectScreen = form.RectangleToScreen(form.ScreenRectangle0Based);
|
||||
rectScreen = form.RectangleToScreen(form.ClientArea);
|
||||
}
|
||||
|
||||
if (!form.IsEditorMode && Config.RememberMenuState && rectScreen.Contains(Config.MenuPosition))
|
||||
if (!form.IsEditorMode && Options.RememberMenuState && rectScreen.Contains(Options.MenuPosition))
|
||||
{
|
||||
menuForm.Location = Config.MenuPosition;
|
||||
menuForm.Location = Options.MenuPosition;
|
||||
}
|
||||
else if (tsMain.Width < rectScreen.Width)
|
||||
{
|
||||
|
@ -1029,9 +1029,9 @@ private void CheckMenuPosition()
|
|||
menuForm.Location = pos;
|
||||
}
|
||||
|
||||
if (!form.IsEditorMode && Config.RememberMenuState)
|
||||
if (!form.IsEditorMode && Options.RememberMenuState)
|
||||
{
|
||||
Config.MenuPosition = pos;
|
||||
Options.MenuPosition = pos;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1066,9 +1066,9 @@ private void SetMenuCollapsed(bool isCollapsed)
|
|||
UpdateMenu();
|
||||
}
|
||||
|
||||
if (!form.IsEditorMode && Config.RememberMenuState)
|
||||
if (!form.IsEditorMode && Options.RememberMenuState)
|
||||
{
|
||||
Config.MenuCollapsed = ToolbarCollapsed;
|
||||
Options.MenuCollapsed = ToolbarCollapsed;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1076,7 +1076,7 @@ private void UpdateMenu()
|
|||
{
|
||||
if (form.IsClosing || menuForm == null || menuForm.IsDisposed) return;
|
||||
|
||||
ShapeType shapeType = CurrentShapeType;
|
||||
ShapeType shapeType = CurrentTool;
|
||||
|
||||
foreach (ToolStripButton tsb in tsMain.Items.OfType<ToolStripButton>().Where(x => x.Tag is ShapeType))
|
||||
{
|
||||
|
@ -1256,7 +1256,7 @@ private void UpdateMenu()
|
|||
|
||||
if (tsmiRegionCapture != null)
|
||||
{
|
||||
tsmiRegionCapture.Visible = !Config.QuickCrop && ValidRegions.Length > 0;
|
||||
tsmiRegionCapture.Visible = !Options.QuickCrop && ValidRegions.Length > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue