FancyZones editor display zone numbers & PowerRename fix (#1726)

* Fix for issue #1218

Design Change: Default Enter Action

* Fix for issue #1085

* change zone's number color and font
remove the light blue background

* Fix for disappearing zone number in editor

* Grid layout reversed order fix

Co-authored-by: sqrlmn <sqrlmn@users.noreply.github.com>
Co-authored-by: Enrico Giordani <enrico.giordani@gmail.com>
This commit is contained in:
PrzemyslawTusinski
2020-03-27 13:07:19 +01:00
committed by GitHub
parent 0aeecc7a99
commit f9a756d1ff
8 changed files with 88 additions and 45 deletions

View File

@@ -71,6 +71,7 @@ namespace FancyZonesEditor
Canvas.SetTop(zone, rect.Y); Canvas.SetTop(zone, rect.Y);
zone.Height = rect.Height; zone.Height = rect.Height;
zone.Width = rect.Width; zone.Width = rect.Width;
zone.LabelID.Content = i + 1;
} }
} }
} }

View File

@@ -40,5 +40,16 @@
</DockPanel> </DockPanel>
<Rectangle Fill="LightGray" Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="3"/> <Rectangle Fill="LightGray" Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="3"/>
<Canvas x:Name="Body" /> <Canvas x:Name="Body" />
<Label Name="LabelID"
Content="ID"
Canvas.Left="10"
Canvas.Bottom="10"
FontSize="80"
FontFamily="Segoe UI"
Foreground="Black"
Grid.Column="2"
Grid.Row="3"
VerticalContentAlignment="Center"
HorizontalContentAlignment="Center" />
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -1,11 +1,13 @@
<UserControl x:Class="FancyZonesEditor.GridEditor" <UserControl
x:Class="FancyZonesEditor.GridEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FancyZonesEditor" xmlns:local="clr-namespace:FancyZonesEditor"
mc:Ignorable="d" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450" d:DesignWidth="800"> d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources> <UserControl.Resources>
<Style TargetType="Button"> <Style TargetType="Button">
<Setter Property="FontFamily" Value="Segoe UI" /> <Setter Property="FontFamily" Value="Segoe UI" />
@@ -20,12 +22,26 @@
<Grid> <Grid>
<Canvas x:Name="Preview" /> <Canvas x:Name="Preview" />
<Canvas x:Name="AdornerLayer" /> <Canvas x:Name="AdornerLayer" />
<Canvas x:Name="MergePanel" Visibility="Collapsed" MouseUp="MergePanelMouseUp"> <Canvas
x:Name="MergePanel"
MouseUp="MergePanelMouseUp"
Visibility="Collapsed">
<StackPanel x:Name="MergeButtons" Background="Gray" Orientation="Horizontal"> <StackPanel
<Button Click="MergeClick" Margin="0" Height="36" Width="134"> x:Name="MergeButtons"
Background="Gray"
Orientation="Horizontal">
<Button
Width="134"
Height="36"
Margin="0"
Click="MergeClick">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<Image Source="images/Merge.png" Margin="0,0,12,0" Height="16" HorizontalAlignment="Left" /> <Image
Height="16"
Margin="0,0,12,0"
HorizontalAlignment="Left"
Source="images/Merge.png" />
<TextBlock Text="Merge zones" /> <TextBlock Text="Merge zones" />
</StackPanel> </StackPanel>
</Button> </Button>

View File

@@ -569,6 +569,7 @@ namespace FancyZonesEditor
top = _rowInfo[row].Start; top = _rowInfo[row].Start;
Canvas.SetLeft(zone, left); Canvas.SetLeft(zone, left);
Canvas.SetTop(zone, top); Canvas.SetTop(zone, top);
zone.LabelID.Content = i + 1;
int maxRow = row; int maxRow = row;
while (((maxRow + 1) < rows) && (model.CellChildMap[maxRow + 1, col] == i)) while (((maxRow + 1) < rows) && (model.CellChildMap[maxRow + 1, col] == i))

View File

@@ -1,17 +1,31 @@
<UserControl x:Class="FancyZonesEditor.GridZone" <UserControl
x:Class="FancyZonesEditor.GridZone"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FancyZonesEditor" xmlns:local="clr-namespace:FancyZonesEditor"
mc:Ignorable="d" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
Background="LightGray" Background="LightGray"
BorderThickness="1"
BorderBrush="DarkGray" BorderBrush="DarkGray"
BorderThickness="1"
Opacity="0.5" Opacity="0.5"
d:DesignHeight="450" d:DesignWidth="800"> mc:Ignorable="d">
<Grid x:Name="Frame" Visibility="Collapsed"> <Grid x:Name="Frame">
<Canvas x:Name="Body" /> <Canvas x:Name="Body" />
<Label
Name="LabelID"
Grid.Row="3"
Grid.Column="2"
Canvas.Left="10"
Canvas.Bottom="10"
HorizontalContentAlignment="Center"
VerticalContentAlignment="Center"
Content="ID"
FontFamily="Segoe UI"
FontSize="80"
Foreground="Black" />
<!--<TextBlock Margin="2" Text="Shift Key switches direction&#13;Ctrl Key repeats"/>--> <!--<TextBlock Margin="2" Text="Shift Key switches direction&#13;Ctrl Key repeats"/>-->
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -146,13 +146,13 @@ namespace FancyZonesEditor
protected override void OnMouseEnter(MouseEventArgs e) protected override void OnMouseEnter(MouseEventArgs e)
{ {
Frame.Visibility = Visibility.Visible; _splitter.Fill = Brushes.DarkGray;
base.OnMouseEnter(e); base.OnMouseEnter(e);
} }
protected override void OnMouseLeave(MouseEventArgs e) protected override void OnMouseLeave(MouseEventArgs e)
{ {
Frame.Visibility = Visibility.Collapsed; _splitter.Fill = Brushes.Transparent;
base.OnMouseLeave(e); base.OnMouseLeave(e);
} }

View File

@@ -329,15 +329,15 @@ namespace FancyZonesEditor
_gridModel.ColumnPercents[col] = ((_multiplier * (col + 1)) / cols) - ((_multiplier * col) / cols); _gridModel.ColumnPercents[col] = ((_multiplier * (col + 1)) / cols) - ((_multiplier * col) / cols);
} }
int index = 0; int index = ZoneCount - 1;
for (int col = cols - 1; col >= 0; col--)
{
for (int row = rows - 1; row >= 0; row--) for (int row = rows - 1; row >= 0; row--)
{ {
_gridModel.CellChildMap[row, col] = index++; for (int col = cols - 1; col >= 0; col--)
if (index == ZoneCount)
{ {
index--; _gridModel.CellChildMap[row, col] = index--;
if (index < 0)
{
index = 0; ;
} }
} }
} }

View File

@@ -653,10 +653,6 @@ void CPowerRenameUI::_OnCommand(_In_ WPARAM wParam, _In_ LPARAM lParam)
switch (LOWORD(wParam)) switch (LOWORD(wParam))
{ {
case IDOK: case IDOK:
case IDCANCEL:
_OnCloseDlg();
break;
case ID_RENAME: case ID_RENAME:
_OnRename(); _OnRename();
break; break;
@@ -665,6 +661,10 @@ void CPowerRenameUI::_OnCommand(_In_ WPARAM wParam, _In_ LPARAM lParam)
_OnAbout(); _OnAbout();
break; break;
case IDCANCEL:
_OnCloseDlg();
break;
case IDC_EDIT_REPLACEWITH: case IDC_EDIT_REPLACEWITH:
case IDC_EDIT_SEARCHFOR: case IDC_EDIT_SEARCHFOR:
if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE) if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE)