Skip to content

Commit d25e1ea

Browse files
Apply code formatting to all files
Co-authored-by: RuntimeRascal <2422222+RuntimeRascal@users.noreply.github.com>
1 parent e662f8e commit d25e1ea

26 files changed

+128
-128
lines changed

Src/GhostDraw/App.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ private void OnScreenshotFullPressed(object? sender, EventArgs e)
368368
_logger?.LogInformation("====== OnScreenshotFullPressed CALLED ======");
369369
_logger?.LogInformation("DrawingManager null: {IsNull}", _drawingManager == null);
370370
_logger?.LogInformation("DrawingManager.IsDrawingMode: {IsDrawingMode}", _drawingManager?.IsDrawingMode);
371-
371+
372372
// Capture full screenshot if drawing mode is active
373373
if (_drawingManager?.IsDrawingMode == true)
374374
{
@@ -394,7 +394,7 @@ private void OnUndoPressed(object? sender, EventArgs e)
394394
try
395395
{
396396
_logger?.LogInformation("Ctrl+Z pressed - undoing last action");
397-
397+
398398
// Undo last action if drawing mode is active
399399
if (_drawingManager?.IsDrawingMode == true)
400400
{

Src/GhostDraw/Core/AppSettings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public class AppSettings
8686
/// </summary>
8787
[JsonPropertyName("screenshotSavePath")]
8888
public string ScreenshotSavePath { get; set; } = System.IO.Path.Combine(
89-
Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),
89+
Environment.GetFolderPath(Environment.SpecialFolder.MyPictures),
9090
"GhostDraw");
9191

9292
/// <summary>

Src/GhostDraw/Core/DrawTool.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,22 @@ public enum DrawTool
1212
/// Freehand drawing tool (default)
1313
/// </summary>
1414
Pen,
15-
15+
1616
/// <summary>
1717
/// Straight line tool - click two points to draw a line
1818
/// </summary>
1919
Line,
20-
20+
2121
/// <summary>
2222
/// Eraser tool - removes drawing objects underneath the cursor
2323
/// </summary>
2424
Eraser,
25-
25+
2626
/// <summary>
2727
/// Rectangle tool - click two points to draw a rectangle
2828
/// </summary>
2929
Rectangle,
30-
30+
3131
/// <summary>
3232
/// Circle tool - click two points to draw a circle/ellipse
3333
/// </summary>

Src/GhostDraw/Core/GlobalKeyboardHook.cs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class GlobalKeyboardHook : IDisposable
5353
private Dictionary<int, bool> _keyStates = new();
5454
private bool _wasHotkeyActive = false;
5555
private volatile bool _isControlPressed = false;
56-
56+
5757
// Drawing mode state - used to determine if we should suppress keys
5858
private volatile bool _isDrawingModeActive = false;
5959

@@ -67,7 +67,7 @@ public GlobalKeyboardHook(ILogger<GlobalKeyboardHook> logger)
6767
foreach (var vk in _hotkeyVKs)
6868
_keyStates[vk] = false;
6969
}
70-
70+
7171
/// <summary>
7272
/// Configures the hotkey combination
7373
/// </summary>
@@ -186,7 +186,7 @@ private nint SetHook(LowLevelKeyboardProc proc)
186186
private nint HookCallback(int nCode, nint wParam, nint lParam)
187187
{
188188
bool shouldSuppressKey = false;
189-
189+
190190
try
191191
{
192192
if (nCode >= 0)
@@ -204,8 +204,8 @@ private nint HookCallback(int nCode, nint wParam, nint lParam)
204204
if (vkCode == VK_LCONTROL || vkCode == VK_RCONTROL)
205205
{
206206
_isControlPressed = isKeyDown;
207-
_logger.LogDebug("Control key ({Type}) {State}",
208-
vkCode == VK_LCONTROL ? "Left" : "Right",
207+
_logger.LogDebug("Control key ({Type}) {State}",
208+
vkCode == VK_LCONTROL ? "Left" : "Right",
209209
isKeyDown ? "PRESSED" : "RELEASED");
210210
}
211211

@@ -271,12 +271,12 @@ private nint HookCallback(int nCode, nint wParam, nint lParam)
271271
_logger.LogInformation("====== CTRL+S DETECTED ======");
272272
_logger.LogInformation("Control key state: {IsControlPressed}", _isControlPressed);
273273
_logger.LogInformation("Drawing mode active: {IsDrawingModeActive}", _isDrawingModeActive);
274-
274+
275275
_logger.LogInformation("Ctrl+S pressed - firing ScreenshotFullPressed event");
276276
ScreenshotFullPressed?.Invoke(this, EventArgs.Empty);
277-
_logger.LogInformation("ScreenshotFullPressed event fired, subscribers: {Count}",
277+
_logger.LogInformation("ScreenshotFullPressed event fired, subscribers: {Count}",
278278
ScreenshotFullPressed?.GetInvocationList().Length ?? 0);
279-
279+
280280
// Suppress Ctrl+S when drawing mode is active to prevent Windows Snipping Tool
281281
if (_isDrawingModeActive)
282282
{
@@ -287,7 +287,7 @@ private nint HookCallback(int nCode, nint wParam, nint lParam)
287287
{
288288
_logger.LogInformation("KEY WILL NOT BE SUPPRESSED - Drawing mode is inactive");
289289
}
290-
290+
291291
_logger.LogInformation("====== END CTRL+S HANDLING ======");
292292
}
293293

@@ -296,7 +296,7 @@ private nint HookCallback(int nCode, nint wParam, nint lParam)
296296
{
297297
_logger.LogInformation("Ctrl+Z pressed - firing UndoPressed event");
298298
UndoPressed?.Invoke(this, EventArgs.Empty);
299-
299+
300300
// Suppress Ctrl+Z when drawing mode is active to prevent underlying apps from receiving it
301301
shouldSuppressKey = true;
302302
_logger.LogDebug("Ctrl+Z suppressed - drawing mode is active");
@@ -341,7 +341,7 @@ private nint HookCallback(int nCode, nint wParam, nint lParam)
341341
_logger.LogTrace("Key suppressed - not calling CallNextHookEx");
342342
return (nint)1;
343343
}
344-
344+
345345
// MUST call CallNextHookEx for non-suppressed keys to allow other applications to process them
346346
return CallNextHookEx(_hookID, nCode, wParam, lParam);
347347
}
@@ -372,7 +372,7 @@ public void SetDrawingModeActive(bool isActive)
372372
{
373373
var previousState = _isDrawingModeActive;
374374
_isDrawingModeActive = isActive;
375-
375+
376376
if (previousState != isActive)
377377
{
378378
_logger.LogInformation("====== DRAWING MODE STATE CHANGED ======");

Src/GhostDraw/Helpers/CursorHelper.cs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ public WpfCursor CreateEraserCursor()
216216
for (int i = 0; i < 3; i++)
217217
{
218218
int offset = i * 5;
219-
g.DrawLine(texturePen,
220-
eraserLeft + offset, eraserTop,
219+
g.DrawLine(texturePen,
220+
eraserLeft + offset, eraserTop,
221221
eraserLeft + offset + 6, eraserTop + eraserHeight);
222222
}
223223
}
@@ -410,7 +410,7 @@ public WpfCursor CreateLineCursor(string colorHex)
410410
// Left circle is at the hotspot (where the mouse clicks)
411411
int circleRadius = 4;
412412
int circleSpacing = 20; // Increased spacing for better visibility
413-
413+
414414
// Position left circle at the hotspot (6 pixels from left edge for visual balance)
415415
Point leftCircleCenter = new Point(6, size / 2);
416416
Point rightCircleCenter = new Point(6 + circleSpacing, size / 2);
@@ -424,36 +424,36 @@ public WpfCursor CreateLineCursor(string colorHex)
424424
// Draw left circle (outline) - this is where the line starts
425425
using (Pen circlePen = new Pen(Color.White, 2))
426426
{
427-
g.DrawEllipse(circlePen,
428-
leftCircleCenter.X - circleRadius,
429-
leftCircleCenter.Y - circleRadius,
430-
circleRadius * 2,
427+
g.DrawEllipse(circlePen,
428+
leftCircleCenter.X - circleRadius,
429+
leftCircleCenter.Y - circleRadius,
430+
circleRadius * 2,
431431
circleRadius * 2);
432432
}
433433
using (Pen circleOutline = new Pen(Color.Black, 1))
434434
{
435-
g.DrawEllipse(circleOutline,
436-
leftCircleCenter.X - circleRadius - 1,
437-
leftCircleCenter.Y - circleRadius - 1,
438-
circleRadius * 2 + 2,
435+
g.DrawEllipse(circleOutline,
436+
leftCircleCenter.X - circleRadius - 1,
437+
leftCircleCenter.Y - circleRadius - 1,
438+
circleRadius * 2 + 2,
439439
circleRadius * 2 + 2);
440440
}
441441

442442
// Draw right circle (outline)
443443
using (Pen circlePen = new Pen(Color.White, 2))
444444
{
445-
g.DrawEllipse(circlePen,
446-
rightCircleCenter.X - circleRadius,
447-
rightCircleCenter.Y - circleRadius,
448-
circleRadius * 2,
445+
g.DrawEllipse(circlePen,
446+
rightCircleCenter.X - circleRadius,
447+
rightCircleCenter.Y - circleRadius,
448+
circleRadius * 2,
449449
circleRadius * 2);
450450
}
451451
using (Pen circleOutline = new Pen(Color.Black, 1))
452452
{
453-
g.DrawEllipse(circleOutline,
454-
rightCircleCenter.X - circleRadius - 1,
455-
rightCircleCenter.Y - circleRadius - 1,
456-
circleRadius * 2 + 2,
453+
g.DrawEllipse(circleOutline,
454+
rightCircleCenter.X - circleRadius - 1,
455+
rightCircleCenter.Y - circleRadius - 1,
456+
circleRadius * 2 + 2,
457457
circleRadius * 2 + 2);
458458
}
459459

Src/GhostDraw/Services/AppSettingsService.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ private AppSettings LoadSettings()
4848
if (settings != null)
4949
{
5050
_logger.LogInformation("Settings loaded successfully");
51-
51+
5252
// Save to ensure latest format
5353
_settingsStore.Save(settings);
5454
return settings;
@@ -280,8 +280,8 @@ public void SetActiveTool(DrawTool tool)
280280
/// </summary>
281281
public DrawTool ToggleTool()
282282
{
283-
var newTool = _currentSettings.ActiveTool == DrawTool.Pen
284-
? DrawTool.Line
283+
var newTool = _currentSettings.ActiveTool == DrawTool.Pen
284+
? DrawTool.Line
285285
: DrawTool.Pen;
286286
SetActiveTool(newTool);
287287
return newTool;

Src/GhostDraw/Services/DrawingHistory.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ namespace GhostDraw.Services;
1010
public class DrawingHistory
1111
{
1212
private readonly ILogger<DrawingHistory> _logger;
13-
13+
1414
// Stack of completed drawing actions (most recent at the top)
1515
private readonly Stack<HistoryEntry> _undoStack = new();
16-
16+
1717
// Dictionary for O(1) lookup when eraser needs to remove history entries
1818
private readonly Dictionary<Guid, HistoryEntry> _elementIdToEntry = new();
1919

@@ -46,7 +46,7 @@ public void RecordAction(UIElement element)
4646
_undoStack.Push(entry);
4747
_elementIdToEntry[id] = entry;
4848

49-
_logger.LogDebug("Action recorded: ID={Id}, Type={Type}, StackSize={StackSize}",
49+
_logger.LogDebug("Action recorded: ID={Id}, Type={Type}, StackSize={StackSize}",
5050
id, element.GetType().Name, _undoStack.Count);
5151
}
5252
else
@@ -71,7 +71,7 @@ public void RecordAction(UIElement element)
7171
while (_undoStack.Count > 0)
7272
{
7373
var entry = _undoStack.Pop();
74-
74+
7575
// Remove from dictionary
7676
_elementIdToEntry.Remove(entry.Id);
7777

@@ -115,7 +115,7 @@ public void RemoveFromHistory(UIElement element)
115115
// Mark the entry's element as null so it will be skipped during undo
116116
entry.Element = null;
117117
_elementIdToEntry.Remove(id);
118-
118+
119119
_logger.LogDebug("Element removed from history: ID={Id}, Type={Type}",
120120
id, element.GetType().Name);
121121
}
@@ -145,7 +145,7 @@ public void Clear()
145145
var count = _undoStack.Count;
146146
_undoStack.Clear();
147147
_elementIdToEntry.Clear();
148-
148+
149149
if (count > 0)
150150
{
151151
_logger.LogInformation("History cleared: {Count} entries removed", count);

Src/GhostDraw/Tools/CircleTool.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ private void UpdateCircle(Point startPoint, Point currentPoint, bool isPerfectCi
138138
if (isPerfectCircle)
139139
{
140140
double maxDimension = Math.Max(width, height);
141-
141+
142142
// Adjust left/top based on which quadrant we're dragging to
143143
// Determine the quadrant based on current position relative to start
144144
bool isDraggingLeft = currentPoint.X < startPoint.X;
145145
bool isDraggingUp = currentPoint.Y < startPoint.Y;
146-
146+
147147
if (isDraggingLeft && isDraggingUp)
148148
{
149149
// Top-left quadrant
@@ -168,7 +168,7 @@ private void UpdateCircle(Point startPoint, Point currentPoint, bool isPerfectCi
168168
left = startPoint.X;
169169
top = startPoint.Y;
170170
}
171-
171+
172172
width = maxDimension;
173173
height = maxDimension;
174174
}
@@ -187,7 +187,7 @@ private void FinishCircle(Point endPoint)
187187
bool isShiftPressed = Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift);
188188
UpdateCircle(_circleStartPoint.Value, endPoint, isShiftPressed);
189189
_logger.LogInformation("Circle finished at ({X:F0}, {Y:F0})", endPoint.X, endPoint.Y);
190-
190+
191191
// Fire ActionCompleted event for history tracking
192192
ActionCompleted?.Invoke(this, new DrawingActionCompletedEventArgs(_currentCircle));
193193
}

Src/GhostDraw/Tools/EraserTool.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace GhostDraw.Tools;
1313
public class ElementErasedEventArgs : EventArgs
1414
{
1515
public UIElement Element { get; }
16-
16+
1717
public ElementErasedEventArgs(UIElement element)
1818
{
1919
Element = element;
@@ -31,7 +31,7 @@ public class EraserTool(ILogger<EraserTool> logger) : IDrawingTool
3131
private readonly HashSet<UIElement> _erasedElements = new();
3232

3333
public event EventHandler<DrawingActionCompletedEventArgs>? ActionCompleted;
34-
34+
3535
/// <summary>
3636
/// Event fired when elements are erased (for history removal)
3737
/// </summary>
@@ -161,13 +161,13 @@ private void EraseAtPosition(Point position, Canvas canvas)
161161
// Check if eraser intersects with rectangle bounds
162162
double left = Canvas.GetLeft(rectangle);
163163
double top = Canvas.GetTop(rectangle);
164-
164+
165165
// Handle NaN values (shouldn't happen, but be defensive)
166-
if (!double.IsNaN(left) && !double.IsNaN(top) &&
166+
if (!double.IsNaN(left) && !double.IsNaN(top) &&
167167
!double.IsNaN(rectangle.Width) && !double.IsNaN(rectangle.Height))
168168
{
169169
Rect shapeRect = new Rect(left, top, rectangle.Width, rectangle.Height);
170-
170+
171171
if (eraserRect.IntersectsWith(shapeRect))
172172
{
173173
shouldErase = true;
@@ -179,13 +179,13 @@ private void EraseAtPosition(Point position, Canvas canvas)
179179
// Check if eraser intersects with ellipse bounds
180180
double left = Canvas.GetLeft(ellipse);
181181
double top = Canvas.GetTop(ellipse);
182-
182+
183183
// Handle NaN values (shouldn't happen, but be defensive)
184-
if (!double.IsNaN(left) && !double.IsNaN(top) &&
184+
if (!double.IsNaN(left) && !double.IsNaN(top) &&
185185
!double.IsNaN(ellipse.Width) && !double.IsNaN(ellipse.Height))
186186
{
187187
Rect ellipseRect = new Rect(left, top, ellipse.Width, ellipse.Height);
188-
188+
189189
if (eraserRect.IntersectsWith(ellipseRect))
190190
{
191191
shouldErase = true;
@@ -205,7 +205,7 @@ private void EraseAtPosition(Point position, Canvas canvas)
205205
{
206206
canvas.Children.Remove(element);
207207
_logger.LogTrace("Erased element at position ({X:F0}, {Y:F0})", position.X, position.Y);
208-
208+
209209
// Fire ElementErased event for history removal
210210
ElementErased?.Invoke(this, new ElementErasedEventArgs(element));
211211
}

0 commit comments

Comments
 (0)