Skip to content

Commit

Permalink
FancyZones editor display zone numbers & PowerRename fix (#1726)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people committed Mar 27, 2020
1 parent 0aeecc7 commit f9a756d
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 45 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ private void UpdateZoneRects()
Canvas.SetTop(zone, rect.Y);
zone.Height = rect.Height;
zone.Width = rect.Width;
zone.LabelID.Content = i + 1;
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/modules/fancyzones/editor/FancyZonesEditor/CanvasZone.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,16 @@
</DockPanel>
<Rectangle Fill="LightGray" Grid.Row="3" Grid.Column="1" Grid.RowSpan="2" Grid.ColumnSpan="3"/>
<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>
</UserControl>
56 changes: 36 additions & 20 deletions src/modules/fancyzones/editor/FancyZonesEditor/GridEditor.xaml
Original file line number Diff line number Diff line change
@@ -1,32 +1,48 @@
<UserControl x:Class="FancyZonesEditor.GridEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:local="clr-namespace:FancyZonesEditor"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl
x:Class="FancyZonesEditor.GridEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FancyZonesEditor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<Style TargetType="Button">
<Setter Property="FontFamily" Value="Segoe UI" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="Foreground" Value="Black"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="Background" Value="#F2F2F2"/>
<Setter Property="Width" Value="150"/>
<Setter Property="Foreground" Value="Black" />
<Setter Property="FontSize" Value="14" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="#F2F2F2" />
<Setter Property="Width" Value="150" />
</Style>
</UserControl.Resources>
<Grid>
<Canvas x:Name="Preview"/>
<Canvas x:Name="AdornerLayer"/>
<Canvas x:Name="MergePanel" Visibility="Collapsed" MouseUp="MergePanelMouseUp">
<Canvas x:Name="Preview" />
<Canvas x:Name="AdornerLayer" />
<Canvas
x:Name="MergePanel"
MouseUp="MergePanelMouseUp"
Visibility="Collapsed">

<StackPanel x:Name="MergeButtons" Background="Gray" Orientation="Horizontal">
<Button Click="MergeClick" Margin="0" Height="36" Width="134">
<StackPanel
x:Name="MergeButtons"
Background="Gray"
Orientation="Horizontal">
<Button
Width="134"
Height="36"
Margin="0"
Click="MergeClick">
<StackPanel Orientation="Horizontal">
<Image Source="images/Merge.png" Margin="0,0,12,0" Height="16" HorizontalAlignment="Left" />
<TextBlock Text="Merge zones"/>
<Image
Height="16"
Margin="0,0,12,0"
HorizontalAlignment="Left"
Source="images/Merge.png" />
<TextBlock Text="Merge zones" />
</StackPanel>
</Button>
</StackPanel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ private void ArrangeGridRects(Size arrangeSize)
top = _rowInfo[row].Start;
Canvas.SetLeft(zone, left);
Canvas.SetTop(zone, top);
zone.LabelID.Content = i + 1;

int maxRow = row;
while (((maxRow + 1) < rows) && (model.CellChildMap[maxRow + 1, col] == i))
Expand Down
40 changes: 27 additions & 13 deletions src/modules/fancyzones/editor/FancyZonesEditor/GridZone.xaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
<UserControl x:Class="FancyZonesEditor.GridZone"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
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:local="clr-namespace:FancyZonesEditor"
mc:Ignorable="d"
Background="LightGray"
BorderThickness="1"
BorderBrush="DarkGray"
Opacity="0.5"
d:DesignHeight="450" d:DesignWidth="800">
<Grid x:Name="Frame" Visibility="Collapsed">
<UserControl
x:Class="FancyZonesEditor.GridZone"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:FancyZonesEditor"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="450"
d:DesignWidth="800"
Background="LightGray"
BorderBrush="DarkGray"
BorderThickness="1"
Opacity="0.5"
mc:Ignorable="d">
<Grid x:Name="Frame">
<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"/>-->
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ private void UpdateSplitter()

protected override void OnMouseEnter(MouseEventArgs e)
{
Frame.Visibility = Visibility.Visible;
_splitter.Fill = Brushes.DarkGray;
base.OnMouseEnter(e);
}

protected override void OnMouseLeave(MouseEventArgs e)
{
Frame.Visibility = Visibility.Collapsed;
_splitter.Fill = Brushes.Transparent;
base.OnMouseLeave(e);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,15 +329,15 @@ private void UpdateLayoutModels()
_gridModel.ColumnPercents[col] = ((_multiplier * (col + 1)) / cols) - ((_multiplier * col) / cols);
}

int index = 0;
for (int col = cols - 1; col >= 0; col--)
int index = ZoneCount - 1;
for (int row = rows - 1; row >= 0; row--)
{
for (int row = rows - 1; row >= 0; row--)
for (int col = cols - 1; col >= 0; col--)
{
_gridModel.CellChildMap[row, col] = index++;
if (index == ZoneCount)
_gridModel.CellChildMap[row, col] = index--;
if (index < 0)
{
index--;
index = 0; ;
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/modules/powerrename/ui/PowerRenameUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,6 @@ void CPowerRenameUI::_OnCommand(_In_ WPARAM wParam, _In_ LPARAM lParam)
switch (LOWORD(wParam))
{
case IDOK:
case IDCANCEL:
_OnCloseDlg();
break;

case ID_RENAME:
_OnRename();
break;
Expand All @@ -665,6 +661,10 @@ void CPowerRenameUI::_OnCommand(_In_ WPARAM wParam, _In_ LPARAM lParam)
_OnAbout();
break;

case IDCANCEL:
_OnCloseDlg();
break;

case IDC_EDIT_REPLACEWITH:
case IDC_EDIT_SEARCHFOR:
if (GET_WM_COMMAND_CMD(wParam, lParam) == EN_CHANGE)
Expand Down

0 comments on commit f9a756d

Please sign in to comment.