Skip to content

Commit 3cd09ed

Browse files
authored
Merge pull request #50 from TruePadawan/add-keybindings
Add HotKeys for Pointer tools and Menu Options
2 parents 135230b + fe44b9f commit 3cd09ed

File tree

12 files changed

+45
-5
lines changed

12 files changed

+45
-5
lines changed

Scribble/Tools/PointerTools/ArrowTool/ArrowTool.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public ArrowTool(string name, MainViewModel viewModel) : base(name, viewModel,
3030
Color = SKColors.Red
3131
};
3232
_startPoint = null;
33+
34+
HotKey = new KeyGesture(Key.D5);
35+
ToolTip = "Arrow Tool - 5";
3336
}
3437

3538
public override void HandlePointerClick(Point coord)

Scribble/Tools/PointerTools/EllipseTool/EllipseTool.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public EllipseTool(string name, MainViewModel viewModel) : base(name, viewModel,
3434
Color = SKColors.Red,
3535
};
3636
_startPoint = null;
37+
38+
HotKey = new KeyGesture(Key.D6);
39+
ToolTip = "Ellipse Tool - 6";
3740
}
3841

3942
public override void HandlePointerClick(Point coord)

Scribble/Tools/PointerTools/EraseTool/EraseTool.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public EraseTool(string name, MainViewModel viewModel)
1616
: base(name, viewModel, LoadToolBitmap(typeof(EraseTool), "eraser.png"))
1717
{
1818
Cursor = new Cursor(ToolIcon.CreateScaledBitmap(new PixelSize(36, 36)), new PixelPoint(10, 30));
19+
20+
HotKey = new KeyGesture(Key.D2);
21+
ToolTip = "Erase Tool - 2";
1922
}
2023

2124
public override void HandlePointerClick(Point coord)

Scribble/Tools/PointerTools/LineTool/LineTool.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public LineTool(string name, MainViewModel viewModel) : base(name, viewModel,
3030
Color = SKColors.Red,
3131
};
3232
_startPoint = null;
33+
34+
HotKey = new KeyGesture(Key.D4);
35+
ToolTip = "Line Tool - 4";
3336
}
3437

3538
public override void HandlePointerClick(Point coord)

Scribble/Tools/PointerTools/PanningTool/PanningTool.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ public PanningTool(string name, MainViewModel viewModel, ScrollViewer scrollView
1414
{
1515
_scrollViewer = scrollViewer;
1616
Cursor = new Cursor(ToolIcon.CreateScaledBitmap(new PixelSize(30, 30)), new PixelPoint(15, 15));
17+
18+
HotKey = new KeyGesture(Key.D3);
19+
ToolTip = "Panning Tool - 3";
1720
}
1821

1922
public override void HandlePointerMove(Point prevCoord, Point currentCoord)

Scribble/Tools/PointerTools/PencilTool/PencilTool.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ public PencilTool(string name, MainViewModel viewModel) : base(name, viewModel,
2525
StrokeWidth = 1,
2626
Color = SKColors.Red
2727
};
28+
29+
HotKey = new KeyGesture(Key.D1);
30+
ToolTip = "Pencil Tool - 1";
2831
}
2932

3033
public override void HandlePointerClick(Point coord)

Scribble/Tools/PointerTools/PointerTool.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ public abstract class PointerTool(string name, MainViewModel viewModel, Bitmap i
1919
protected MainViewModel ViewModel { get; } = viewModel;
2020
public readonly Bitmap ToolIcon = icon;
2121
public Cursor? Cursor;
22+
public KeyGesture? HotKey { get; protected init; }
23+
public string ToolTip { get; protected init; } = name;
2224

2325
/// <summary>
2426
/// Loads a bitmap relative to the tool's folder.

Scribble/Tools/PointerTools/RectangleTool/RectangleTool.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ public RectangleTool(string name, MainViewModel viewModel) : base(name, viewMode
3434
Color = SKColors.Red
3535
};
3636
_startPoint = null;
37+
38+
HotKey = new KeyGesture(Key.D7);
39+
ToolTip = "Rectangle Tool - 7";
3740
}
3841

3942
public override void HandlePointerClick(Point coord)

Scribble/Tools/PointerTools/SelectTool/SelectTool.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ public SelectTool(string name, MainViewModel viewModel, Canvas canvasContainer)
2323
{
2424
Cursor = Cursor.Default;
2525
_canvasContainer = canvasContainer;
26+
27+
HotKey = new KeyGesture(Key.D9);
28+
ToolTip = "Select Tool - 9";
2629
}
2730

2831
public override void HandlePointerClick(Point coord)

Scribble/Tools/PointerTools/TextTool/TextTool.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public TextTool(string name, MainViewModel viewModel, Canvas canvasContainer) :
3333
TextSize = 15,
3434
IsAntialias = true
3535
};
36+
37+
HotKey = new KeyGesture(Key.D8);
38+
ToolTip = "Text Tool - 8";
3639
}
3740

3841
public override void HandlePointerClick(Point coord)

0 commit comments

Comments
 (0)