Skip to content

Commit 97d9971

Browse files
Merge pull request #31 from RuntimeRascal/copilot/rework-f1-help-closing-behavior
Implement F1 help toggle with conditional ESC behavior
2 parents b1142ef + a1bc984 commit 97d9971

16 files changed

Lines changed: 635 additions & 76 deletions

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9+
## v1.0.12
10+
11+
### Added
12+
- **F1 Help Toggle Behavior**
13+
- `F1` now toggles the keyboard shortcuts help overlay on and off instead of auto-hiding after a timeout
14+
- Help overlay stays visible until explicitly closed with `F1` or `ESC`
15+
- New tests cover help toggle and ESC behavior to prevent regressions
16+
17+
### Changed
18+
- **ESC Key Behavior with Help Open**
19+
- Pressing `ESC` while help is visible now only closes the help overlay and **does not** exit drawing mode
20+
- Pressing `ESC` when help is hidden still performs the normal emergency exit from drawing mode
21+
- Centralized ESC handling in `OverlayWindow` so drawing manager respects whether it should actually exit
22+
- **Docs**
23+
- Updated the project README
24+
- Added CONTRIBUTING document
25+
26+
927
## v1.0.11
1028

1129
### Added

Installer/GhostDraw.Installer.wixproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="WixToolset.Sdk/4.0.5">
22
<PropertyGroup>
3-
<Version Condition="'$(Version)' == ''">1.0.11</Version>
3+
<Version Condition="'$(Version)' == ''">1.0.12</Version>
44
<OutputName>GhostDrawSetup-$(Version)</OutputName>
55
<OutputType>Package</OutputType>
66
<Platform>x64</Platform>

README.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
[**Download Latest Release**](https://github.com/RuntimeRascal/ghost-draw/releases) | [**Report Bug**](https://github.com/RuntimeRascal/ghost-draw/issues) | [**Request Feature**](https://github.com/RuntimeRascal/ghost-draw/issues)
1515

16-
![GhostDraw Demo](docs/Demo.gif)
17-
<!-- TODO: Add animated GIF showing drawing on screen -->
16+
![GhostDraw Demo](docs/GhostDrawDemo.gif)
1817

1918
</div>
2019

@@ -44,12 +43,6 @@
4443
- **Right-Click Color Cycling** - Quickly switch between your palette colors
4544
- **Position-Numbered Palette** - Easily organize and reorder your favorite colors
4645

47-
### 🛡️ **Safety & Stability**
48-
- **Fail-Safe Design** - Won't lock you out of your system if it crashes
49-
- **Fast Input Processing** - All hooks complete in < 5ms for responsive system
50-
- **Graceful Error Handling** - Protected critical paths ensure stability
51-
- **Proper Resource Cleanup** - Memory and hooks always released properly
52-
5346
---
5447

5548
## 📸 Screenshots
@@ -59,22 +52,19 @@
5952

6053
Customize every aspect of GhostDraw with the intuitive settings panel:
6154
- Color palette management with add/remove/reorder
55+
- ![Color Cycling](docs/ColorPalette.png)
6256
- Brush thickness range configuration
6357
- Hotkey customization
6458
- Drawing mode selection
6559
- Logging level control
6660

67-
### Active Drawing Mode
68-
![Drawing Mode](docs/DrawingMode.png)
69-
<!-- TODO: Add screenshot of drawing overlay in action with colored strokes -->
61+
### Help (F1)
62+
![Drawing Mode](docs/Help.png)
63+
7064

71-
### Color Palette Cycling
72-
![Color Cycling](docs/ColorCycling.png)
73-
<!-- TODO: Add screenshot showing color palette with active color indicator -->
7465

7566
### System Tray Integration
76-
![System Tray](docs/SystemTray.png)
77-
<!-- TODO: Add screenshot of system tray icon and context menu -->
67+
![System Tray](docs/Tray.png)
7868

7969
---
8070

Src/GhostDraw/App.xaml.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,11 +347,11 @@ private void OnHelpPressed(object? sender, EventArgs e)
347347
{
348348
try
349349
{
350-
// Show help overlay if drawing mode is active
350+
// Toggle help overlay if drawing mode is active
351351
if (_drawingManager?.IsDrawingMode == true)
352352
{
353-
_logger?.LogInformation("F1 pressed - showing help");
354-
_drawingManager?.ShowHelp();
353+
_logger?.LogInformation("F1 pressed - toggling help");
354+
_drawingManager?.ToggleHelp();
355355
}
356356
}
357357
catch (Exception ex)

Src/GhostDraw/GhostDraw.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<UseWPF>true</UseWPF>
99
<UseWindowsForms>true</UseWindowsForms>
1010
<ApplicationIcon>Assets\favicon.ico</ApplicationIcon>
11-
<Version>1.0.11</Version>
11+
<Version>1.0.12</Version>
1212
<EnableWindowsTargeting>true</EnableWindowsTargeting>
1313
</PropertyGroup>
1414

Src/GhostDraw/Managers/DrawingManager.cs

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,29 @@ public void ForceDisableDrawing()
148148
{
149149
try
150150
{
151-
_logger.LogInformation("Force disabling drawing mode (ESC pressed)");
152-
_isDrawingLocked = false;
153-
_overlayWindow.DisableDrawing();
154-
_overlayWindow.Hide();
151+
_logger.LogInformation("ESC pressed - checking help visibility");
155152

156-
// Notify hook that drawing mode is inactive
157-
_keyboardHook.SetDrawingModeActive(false);
153+
// Check if help is visible and handle accordingly
154+
bool shouldExitDrawingMode = _overlayWindow.HandleEscapeKey();
158155

159-
_logger.LogDebug("Drawing mode force disabled");
156+
if (shouldExitDrawingMode)
157+
{
158+
// Help was not visible, or user wants to exit - force disable drawing mode
159+
_logger.LogDebug("Force disabling drawing mode");
160+
_isDrawingLocked = false;
161+
_overlayWindow.DisableDrawing();
162+
_overlayWindow.Hide();
163+
164+
// Notify hook that drawing mode is inactive
165+
_keyboardHook.SetDrawingModeActive(false);
166+
167+
_logger.LogDebug("Drawing mode force disabled");
168+
}
169+
else
170+
{
171+
// Help was visible and has been closed - stay in drawing mode
172+
_logger.LogDebug("ESC only closed help - remaining in drawing mode");
173+
}
160174
}
161175
catch (Exception ex)
162176
{
@@ -348,25 +362,25 @@ public void SetCircleTool()
348362
}
349363

350364
/// <summary>
351-
/// Shows the help popup with keyboard shortcuts
365+
/// Toggles the help popup with keyboard shortcuts
352366
/// </summary>
353-
public void ShowHelp()
367+
public void ToggleHelp()
354368
{
355369
try
356370
{
357371
if (_overlayWindow.IsVisible)
358372
{
359-
_overlayWindow.ShowHelp();
360-
_logger.LogInformation("Help popup shown");
373+
_overlayWindow.ToggleHelp();
374+
_logger.LogDebug("Help popup toggled");
361375
}
362376
else
363377
{
364-
_logger.LogDebug("ShowHelp ignored - overlay not visible");
378+
_logger.LogDebug("ToggleHelp ignored - overlay not visible");
365379
}
366380
}
367381
catch (Exception ex)
368382
{
369-
_logger.LogError(ex, "Failed to show help");
383+
_logger.LogError(ex, "Failed to toggle help");
370384
// Don't re-throw - not critical
371385
}
372386
}

Src/GhostDraw/Views/OverlayWindow.xaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@
322322
<TextBlock FontFamily="Segoe UI"
323323
FontSize="16"
324324
Foreground="#B0B0B0"
325-
Text="Exit Draw Mode"/>
325+
Text="Close Help / Exit Draw Mode"/>
326326
</StackPanel>
327327

328328
<StackPanel Orientation="Horizontal" Margin="0,0,0,0">
@@ -336,7 +336,7 @@
336336
<TextBlock FontFamily="Segoe UI"
337337
FontSize="16"
338338
Foreground="#B0B0B0"
339-
Text="Show This Help"/>
339+
Text="Toggle This Help"/>
340340
</StackPanel>
341341
</StackPanel>
342342
</Border>

0 commit comments

Comments
 (0)