Skip to content

Commit 5f82b9a

Browse files
committed
Fixed rotate grid buttons, added tooltips and XAML icons for all buttons.
1 parent 0ffccaf commit 5f82b9a

4 files changed

Lines changed: 45 additions & 17 deletions

File tree

Src/ScreenGrid.ViewModels/ScreenGridViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ public ScreenGridViewModel()
2626
HorizontalAlignment = HorizontalAlignment.Stretch,
2727
};
2828

29-
this.RotateCWCommand = new RelayCommand((o) => { this.Rot = Rotator.RotateClockwise(this.Rot); });
30-
this.RotateCCWCommand = new RelayCommand((o) => { this.Rot = Rotator.RotateCounterClockwise(this.Rot); });
29+
this.RotateClockwiseCommand = new RelayCommand((o) => { this.Rot = Rotator.RotateClockwise(this.Rot); });
30+
this.RotateCounterClockwiseCommand = new RelayCommand((o) => { this.Rot = Rotator.RotateCounterClockwise(this.Rot); });
3131
this.FlipHorizontalCommand = new RelayCommand((o) => { this.FlipH = !this.FlipH; });
3232
this.FlipVerticalCommand = new RelayCommand((o) => { this.FlipV = !this.FlipV; });
3333
this.SnapCommand = new RelayCommand((o) => { this.SnapToRenderView(); });
3434
}
3535

36-
public ICommand RotateCWCommand { get; private set; }
37-
public ICommand RotateCCWCommand { get; private set; }
36+
public ICommand RotateClockwiseCommand { get; private set; }
37+
public ICommand RotateCounterClockwiseCommand { get; private set; }
3838
public ICommand FlipHorizontalCommand { get; private set; }
3939
public ICommand FlipVerticalCommand { get; private set; }
4040
public ICommand SnapCommand { get; private set; }

Src/ScreenGrid.Views/Assets/PathData.xaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,9 @@
2828
<sys:String x:Key="pathDataZoomVertical02">
2929
M384.229,0L768,342.84 509.648,342.957 509.711,901.796 768,901.796 384.034,1244.7 0,901.796 252.798,901.796 252.798,342.957 0,342.84z
3030
</sys:String>
31-
31+
32+
<sys:String x:Key="pathDataRotate01">
33+
M4.9160004,15.04702C5.0160065,15.04702 5.0160065,15.04702 5.1159973,15.146996 5.2169952,15.248009 5.2169952,15.348015 5.2169952,15.44799 5.3170013,16.752007 5.7180023,17.956015 6.3200073,19.159994 7.2230072,20.865011 8.5270081,22.168995 10.132004,22.972004L10.734009,20.564016C10.734009,20.46401 10.934006,20.262991 11.035004,20.262991 11.134995,20.262991 11.335999,20.262991 11.436005,20.46401L13.742996,24.176014 15.850006,27.48601C15.949997,27.585985 15.949997,27.686998 15.850006,27.787005 15.850006,27.887011 15.75,27.986986 15.649002,27.986986L12.238998,29.09099 7.5240021,30.695999C7.423996,30.695999 7.2230072,30.695999 7.1230011,30.595993 7.0220032,30.49501 7.0220032,30.294998 7.1230011,30.193985L8.326004,27.887011C5.6179962,26.582995 3.2100067,24.477009 1.7060089,21.567007 0.70199585,19.762014 0.20100403,17.856009 0,15.950005 0,15.749016 0.10099792,15.549004 0.30099487,15.549004z M25.179001,7.0219999C25.279007,7.0219999,25.380005,7.0219999,25.380005,7.122006L27.988007,9.4290114 31.800003,12.740015C32,12.939996 32,13.041009 32,13.240991 32,13.342004 31.800003,13.44201 31.699005,13.44201L29.091003,13.542016C29.292007,16.551994 28.690002,19.661001 26.884003,22.46999 25.781006,24.176014 24.376007,25.680012 22.872009,26.784014 22.671005,26.883989 22.471008,26.883989 22.369995,26.683001L19.662003,23.07201C19.561005,22.972004 19.561005,22.870991 19.561005,22.771015 19.561005,22.671009 19.662003,22.571003 19.762009,22.571003 20.764999,21.868 21.768005,20.965994 22.471008,19.762014 23.473999,18.157003 23.975006,16.351006 23.875,14.545007L21.466995,15.248009C21.367004,15.248009 21.166,15.248009 21.06601,15.146996 20.966003,15.04702 20.966003,14.846001 21.06601,14.745996L23.173004,10.834009 24.977997,7.3229947C24.977997,7.122006,25.078995,7.122006,25.179001,7.0219999z M14.947006,0C16.953003,-4.0170562E-08 18.960007,0.40100075 20.764999,1.2040096 20.966003,1.3040154 21.06601,1.5050041 20.966003,1.7050162L19.259995,6.0190096C19.259995,6.1190157,19.160004,6.2190218,19.059998,6.2190218L18.759003,6.2190218C17.555008,5.7180148 16.350998,5.4170199 14.947006,5.4170199 13.041,5.4170199 11.235001,6.0190096 9.7310028,7.0219999L11.535995,8.7270165C11.637009,8.8279992 11.637009,9.0280104 11.637009,9.1289931 11.637009,9.2289992 11.436005,9.3290053 11.335999,9.3290053L6.9219971,9.5299941 3.0099945,9.7300063C2.9089966,9.7300063 2.8090057,9.7300063 2.7089996,9.6300002 2.6080017,9.5299941 2.6080017,9.4290114 2.6080017,9.3290053L3.2100067,5.8180209 4.0130005,0.90301464C4.0130005,0.8030086 4.1130066,0.60201995 4.3139954,0.60201977 4.4140015,0.60201995 4.6150055,0.60201995 4.7149963,0.70202587L6.2200012,2.8090196C8.6269989,1.1030268,11.637009,-4.0170562E-08,14.947006,0z
34+
</sys:String>
35+
3236
</ResourceDictionary>

Src/ScreenGrid.Views/ScreenGridWindow.xaml

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,26 +50,41 @@
5050
</Grid.Resources>
5151

5252
<StackPanel Orientation="Horizontal" Grid.Row="0" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
53-
<Button Name="btnMenu" Click="btnMenu_Click">
53+
<Button Name="btnMenu" Click="btnMenu_Click"
54+
ToolTip="Select grid type">
5455
<ContentControl>
5556
<Path Data="{Binding Source={StaticResource pathDataRow}}" />
5657
</ContentControl>
5758
</Button>
58-
<Button Command="{Binding SnapCommand}">
59+
<Button ToolTip="Snap to image borders in topmost window"
60+
Command="{Binding SnapCommand}">
5961
<ContentControl>
6062
<Path Data="{Binding Source={StaticResource pathDataSelection}}" />
6163
</ContentControl>
6264
</Button>
63-
<Button Content="&lt;"
64-
Command="{Binding RotateCCWcommand}" />
65-
<Button Content="&gt;"
66-
Command="{Binding RotateCWcommand}" />
67-
<Button Command="{Binding FlipVerticalCommand}">
65+
<Button ToolTip="Rotate grid counter clockwise"
66+
Command="{Binding RotateCounterClockwiseCommand}">
67+
<ContentControl>
68+
<Path Data="{Binding Source={StaticResource pathDataRotate01}}" />
69+
</ContentControl>
70+
</Button>
71+
<Button ToolTip="Rotate grid clockwise"
72+
Command="{Binding RotateClockwiseCommand}">
73+
<ContentControl>
74+
<Path Data="{Binding Source={StaticResource pathDataRotate01}}" />
75+
<ContentControl.LayoutTransform>
76+
<ScaleTransform ScaleX="-1"/>
77+
</ContentControl.LayoutTransform>
78+
</ContentControl>
79+
</Button>
80+
<Button ToolTip="Flip grid vertical"
81+
Command="{Binding FlipVerticalCommand}">
6882
<ContentControl>
6983
<Path Data="{Binding Source={StaticResource pathDataZoomVertical02}}" />
7084
</ContentControl>
7185
</Button>
72-
<Button Command="{Binding FlipHorizontalCommand}">
86+
<Button ToolTip="Flip grid horizontal"
87+
Command="{Binding FlipHorizontalCommand}">
7388
<ContentControl>
7489
<Path Data="{Binding Source={StaticResource pathDataZoomHorizontal02}}" />
7590
</ContentControl>
@@ -79,16 +94,20 @@
7994
Width="200"
8095
HorizontalAlignment="Stretch"
8196
MouseDown="Window_MouseDown" />
82-
<TextBlock VerticalAlignment="Center" Margin="8,0,0,0" IsHitTestVisible="False"
97+
<TextBlock VerticalAlignment="Center" Margin="8,0,0,0"
98+
IsHitTestVisible="False"
99+
ToolTip="Size of grid internal area"
83100
Text="{Binding CaptionText}" />
84101
</Grid>
85-
<Button Name="btnMinimize" Click="btnMinimize_Click">
102+
<Button Name="btnMinimize" Click="btnMinimize_Click"
103+
ToolTip="Minimize">
86104
<ContentControl IsTabStop="False">
87105
<Path Margin="0,10,0,0"
88106
Data="{Binding Source={StaticResource pathDataMinus}}" />
89107
</ContentControl>
90108
</Button>
91-
<Button Name="btnClose" Click="btnClose_Click">
109+
<Button Name="btnClose" Click="btnClose_Click"
110+
ToolTip="Close">
92111
<ContentControl IsTabStop="False">
93112
<Path Data="{Binding Source={StaticResource pathDataClose}}" />
94113
</ContentControl>

Src/ScreenGrid.Views/ScreenGridWindow.xaml.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
namespace ScreenGrid.Views
22
{
3-
using System;
43
using System.Windows;
54
using System.Windows.Controls;
65
using System.Windows.Input;
6+
using System.Windows.Media;
77

88
public partial class ScreenGridWindow : Window
99
{
@@ -23,6 +23,11 @@ public partial class ScreenGridWindow : Window
2323

2424
public ScreenGridWindow()
2525
{
26+
// TODO: check in high DPI modes
27+
28+
// Making text sharp
29+
TextOptions.SetTextFormattingMode(this, TextFormattingMode.Display);
30+
2631
// TODO: external ViewModel
2732
this.InitializeComponent();
2833
this.vm = new ViewModels.ScreenGridViewModel();

0 commit comments

Comments
 (0)