Skip to content

Commit 8923837

Browse files
2 parents 161da64 + c842f2e commit 8923837

File tree

167 files changed

+5425
-5709
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

167 files changed

+5425
-5709
lines changed

.github/NOTICE.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,3 +674,33 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
674674
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
675675
DEALINGS IN THE SOFTWARE.
676676
```
677+
678+
## NaturalStringComparer
679+
680+
**Source**: [https://github.com/GihanSoft/NaturalStringComparer](https://github.com/GihanSoft/NaturalStringComparer)
681+
682+
### License
683+
684+
```
685+
MIT License
686+
687+
Copyright (c) 2018 Mohammad Babayi
688+
689+
Permission is hereby granted, free of charge, to any person obtaining a copy
690+
of this software and associated documentation files (the "Software"), to deal
691+
in the Software without restriction, including without limitation the rights
692+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
693+
copies of the Software, and to permit persons to whom the Software is
694+
furnished to do so, subject to the following conditions:
695+
696+
The above copyright notice and this permission notice shall be included in all
697+
copies or substantial portions of the Software.
698+
699+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
700+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
701+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
702+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
703+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
704+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
705+
SOFTWARE.
706+
```

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,3 +408,4 @@ FodyWeavers.xsd
408408
# JetBrains Rider
409409
*.sln.iml
410410
.idea/
411+
src/Files.App/Assets/FilesOpenDialog/Files.App.Launcher.exe.sha256

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<PackageVersion Include="OwlCore.Storage" Version="0.12.2" />
3333
<PackageVersion Include="Sentry" Version="5.1.1" />
3434
<PackageVersion Include="SevenZipSharp" Version="1.0.2" />
35+
<PackageVersion Include="SharpZipLib" Version="1.4.2" />
3536
<PackageVersion Include="SQLitePCLRaw.bundle_green" Version="2.1.10" />
3637
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.7.250310001" />
3738
<PackageVersion Include="Microsoft.Graphics.Win2D" Version="1.3.2" />

Files.slnx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@
44
<Platform Name="x64" />
55
<Platform Name="x86" />
66
</Configurations>
7+
<Folder Name="/global/" Id="ddb4ef12-cc4e-5e88-e6fc-71a802f4de97">
8+
<File Path="Directory.Build.props" />
9+
<File Path="Directory.Packages.props" />
10+
</Folder>
711
<Folder Name="/src/" />
812
<Folder Name="/src/core/" Id="8d626ea8-cb54-bc41-363a-217881beba6e">
913
<Project Path="src/Files.Core.SourceGenerator/Files.Core.SourceGenerator.csproj" />

Settings.XamlStyler

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"IndentWithTabs": true
2+
"IndentWithTabs": true,
3+
"NoNewLineMarkupExtensions": "x:Bind, Binding, controls:ThemedIconMarkup",
34
}

src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.Properties.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ private double ItemWidth
152152

153153
private static int CalculateColumns(double containerWidth, double itemWidth)
154154
{
155-
var columns = (int)Math.Round(containerWidth / itemWidth);
155+
var columns = itemWidth > 0 ? (int)Math.Round(containerWidth / itemWidth) : 0;
156156
if (columns == 0)
157157
{
158158
columns = 1;

src/Files.App.Controls/AdaptiveGridView/AdaptiveGridView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ protected virtual double CalculateItemWidth(double containerWidth)
119119
_needContainerMarginForLayout = true;
120120
}
121121

122-
return (containerWidth / columns) - itemMargin.Left - itemMargin.Right;
122+
return columns > 0 ? (containerWidth / columns) - itemMargin.Left - itemMargin.Right : 0;
123123
}
124124

125125
/// <summary>

src/Files.App.Controls/BreadcrumbBar/BreadcrumbBar.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public BreadcrumbBar()
4242
{
4343
DefaultStyleKey = typeof(BreadcrumbBar);
4444

45-
_itemsRepeaterLayout = new(this, 2d);
45+
_itemsRepeaterLayout = new(this);
4646
}
4747

4848
// Methods
@@ -87,12 +87,13 @@ internal protected virtual void RaiseItemDropDownFlyoutClosed(BreadcrumbBarItem
8787

8888
internal protected virtual void OnLayoutUpdated()
8989
{
90-
if (_itemsRepeater is null)
90+
if (_itemsRepeater is null || (_itemsRepeaterLayout.IndexAfterEllipsis > _itemsRepeaterLayout.VisibleItemsCount && _isEllipsisRendered))
9191
return;
9292

93+
if (_ellipsisBreadcrumbBarItem is not null && _isEllipsisRendered != _itemsRepeaterLayout.EllipsisIsRendered)
94+
_ellipsisBreadcrumbBarItem.Visibility = _itemsRepeaterLayout.EllipsisIsRendered ? Visibility.Visible : Visibility.Collapsed;
95+
9396
_isEllipsisRendered = _itemsRepeaterLayout.EllipsisIsRendered;
94-
if (_ellipsisBreadcrumbBarItem is not null)
95-
_ellipsisBreadcrumbBarItem.Visibility = _isEllipsisRendered ? Visibility.Visible : Visibility.Collapsed;
9697

9798
for (int accessibilityIndex = 0, collectionIndex = _itemsRepeaterLayout.IndexAfterEllipsis;
9899
accessibilityIndex < _itemsRepeaterLayout.VisibleItemsCount;

src/Files.App.Controls/BreadcrumbBar/BreadcrumbBar.xaml

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
xmlns:animatedvisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
66
xmlns:local="using:Files.App.Controls">
77

8-
<x:Double x:Key="BreadcrumbBarHeight">32</x:Double>
8+
<x:Double x:Key="BreadcrumbBarHeight">34</x:Double>
99
<x:Double x:Key="BreadcrumbBarMinWidth">120</x:Double>
1010
<x:Double x:Key="BreadcrumbBarEllipsisFontSize">16</x:Double>
1111

1212
<Thickness x:Key="BreadcrumbBarChevronPadding">4,0</Thickness>
1313
<Thickness x:Key="BreadcrumbBarItemPadding">8,0</Thickness>
1414
<Thickness x:Key="BreadcrumbBarRootItemPadding">16,0,8,0</Thickness>
15+
<Thickness x:Key="BreadcrumbBarItemMargin">2,0,0,0</Thickness>
1516

1617
<CornerRadius x:Key="BreadcrumbBarItemCornerRadius">2,2,2,2</CornerRadius>
1718
<CornerRadius x:Key="BreadcrumbBarChevronCornerRaduis">2,2,2,2</CornerRadius>
@@ -21,21 +22,33 @@
2122
<Style BasedOn="{StaticResource DefaultBreadcrumbBarItemStyle}" TargetType="local:BreadcrumbBarItem" />
2223

2324
<Style x:Key="DefaultBreadcrumbBarStyle" TargetType="local:BreadcrumbBar">
25+
2426
<Setter Property="MinWidth" Value="{StaticResource BreadcrumbBarMinWidth}" />
27+
28+
<Setter Property="HorizontalAlignment" Value="Stretch" />
29+
<Setter Property="HorizontalContentAlignment" Value="Center" />
30+
<Setter Property="VerticalAlignment" Value="Stretch" />
31+
<Setter Property="VerticalContentAlignment" Value="Center" />
32+
2533
<Setter Property="AutomationProperties.LandmarkType" Value="Navigation" />
34+
2635
<Setter Property="IsTabStop" Value="False" />
36+
2737
<Setter Property="Template">
2838
<Setter.Value>
2939
<ControlTemplate TargetType="local:BreadcrumbBar">
3040
<Grid
3141
MinWidth="{TemplateBinding MinWidth}"
32-
ColumnSpacing="2"
42+
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
43+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
44+
Background="{TemplateBinding Background}"
3345
TabFocusNavigation="Once"
3446
XYFocusKeyboardNavigation="Enabled">
3547
<Grid.ColumnDefinitions>
3648
<ColumnDefinition Width="Auto" />
3749
<ColumnDefinition Width="Auto" />
3850
<ColumnDefinition Width="*" />
51+
<ColumnDefinition Width="Auto" />
3952
</Grid.ColumnDefinitions>
4053

4154
<local:BreadcrumbBarItem
@@ -50,6 +63,7 @@
5063
<local:BreadcrumbBarItem
5164
x:Name="PART_EllipsisBreadcrumbBarItem"
5265
Grid.Column="1"
66+
Margin="{StaticResource BreadcrumbBarItemMargin}"
5367
AutomationProperties.AccessibilityView="Content"
5468
IsEllipsis="True"
5569
Visibility="Collapsed">
@@ -59,6 +73,8 @@
5973
<ItemsRepeater
6074
x:Name="PART_MainItemsRepeater"
6175
Grid.Column="2"
76+
Margin="{StaticResource BreadcrumbBarItemMargin}"
77+
HorizontalAlignment="Left"
6278
ItemTemplate="{Binding ItemTemplate, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}"
6379
ItemsSource="{Binding ItemsSource, RelativeSource={RelativeSource TemplatedParent}, Mode=OneWay}" />
6480

@@ -85,17 +101,17 @@
85101
<Setter Property="HorizontalAlignment" Value="Stretch" />
86102
<Setter Property="HorizontalContentAlignment" Value="Center" />
87103
<Setter Property="VerticalAlignment" Value="Stretch" />
88-
<Setter Property="VerticalContentAlignment" Value="Center" />
104+
<Setter Property="VerticalContentAlignment" Value="Stretch" />
89105

90106
<Setter Property="FocusVisualMargin" Value="1" />
91107
<Setter Property="IsTabStop" Value="False" />
92108
<Setter Property="UseSystemFocusVisuals" Value="{StaticResource UseSystemFocusVisuals}" />
109+
93110
<Setter Property="Template">
94111
<Setter.Value>
95112
<ControlTemplate TargetType="local:BreadcrumbBarItem">
96113
<Grid
97114
x:Name="PART_LayoutRoot"
98-
ColumnSpacing="2"
99115
TabFocusNavigation="Once"
100116
XYFocusKeyboardNavigation="Enabled">
101117
<Grid.ColumnDefinitions>
@@ -107,14 +123,21 @@
107123
<Button
108124
x:Name="PART_ItemContentButton"
109125
Padding="{TemplateBinding Padding}"
110-
VerticalAlignment="Stretch"
126+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
111127
AutomationProperties.AccessibilityView="Raw"
112128
Background="{TemplateBinding Background}"
113129
BorderBrush="{TemplateBinding BorderBrush}"
114130
BorderThickness="{TemplateBinding BorderThickness}"
115131
Control.IsTemplateFocusTarget="True"
116132
CornerRadius="{TemplateBinding CornerRadius}"
117133
UseSystemFocusVisuals="True">
134+
<Button.Resources>
135+
<ResourceDictionary>
136+
<StaticResource x:Key="ButtonBackgroundPointerOver" ResourceKey="SubtleFillColorTertiaryBrush" />
137+
<StaticResource x:Key="ButtonBackgroundPressed" ResourceKey="SubtleFillColorSecondaryBrush" />
138+
</ResourceDictionary>
139+
</Button.Resources>
140+
118141
<FlyoutBase.AttachedFlyout>
119142
<MenuFlyout
120143
x:Name="PART_ItemEllipsisDropDownMenuFlyout"
@@ -151,15 +174,23 @@
151174
<Button
152175
x:Name="PART_ItemChevronButton"
153176
Grid.Column="1"
177+
Margin="{StaticResource BreadcrumbBarItemMargin}"
154178
Padding="{StaticResource BreadcrumbBarChevronPadding}"
155-
VerticalAlignment="Stretch"
179+
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
156180
AutomationProperties.AccessibilityView="Content"
157181
Background="{TemplateBinding Background}"
158182
BorderBrush="{TemplateBinding BorderBrush}"
159183
BorderThickness="{TemplateBinding BorderThickness}"
160184
CornerRadius="{StaticResource BreadcrumbBarChevronCornerRaduis}"
161185
Style="{StaticResource BreadcrumbBarItemChevronButtonStyle}"
162186
UseSystemFocusVisuals="True">
187+
<Button.Resources>
188+
<ResourceDictionary>
189+
<StaticResource x:Key="ButtonBackgroundPointerOver" ResourceKey="SubtleFillColorTertiaryBrush" />
190+
<StaticResource x:Key="ButtonBackgroundPressed" ResourceKey="SubtleFillColorSecondaryBrush" />
191+
</ResourceDictionary>
192+
</Button.Resources>
193+
163194
<FlyoutBase.AttachedFlyout>
164195
<MenuFlyout
165196
x:Name="PART_ItemChevronDropDownMenuFlyout"

src/Files.App.Controls/BreadcrumbBar/BreadcrumbBarItem.cs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,31 +55,33 @@ protected override void OnApplyTemplate()
5555

5656
public void OnItemClicked()
5757
{
58-
if (_ownerRef is not null &&
59-
_ownerRef.TryGetTarget(out var breadcrumbBar))
58+
if (_ownerRef is null ||
59+
!_ownerRef.TryGetTarget(out var breadcrumbBar))
60+
return;
61+
62+
if (IsEllipsis)
6063
{
61-
if (IsEllipsis)
62-
{
63-
// Clear items in the ellipsis flyout
64-
_itemEllipsisDropDownMenuFlyout.Items.Clear();
64+
// Clear items in the ellipsis flyout
65+
_itemEllipsisDropDownMenuFlyout.Items.Clear();
6566

66-
// Populate items in the ellipsis flyout
67-
for (int index = 0; index < breadcrumbBar.IndexAfterEllipsis; index++)
67+
// Populate items in the ellipsis flyout
68+
for (int index = 0; index < breadcrumbBar.IndexAfterEllipsis; index++)
69+
{
70+
if (breadcrumbBar.TryGetElement(index, out var item) && item?.Content is string text)
6871
{
69-
if (breadcrumbBar.TryGetElement(index, out var item) && item?.Content is string text)
70-
{
71-
_itemEllipsisDropDownMenuFlyout.Items.Add(new MenuFlyoutItem() { Text = text });
72-
}
72+
var menuFlyoutItem = new MenuFlyoutItem() { Text = text };
73+
_itemEllipsisDropDownMenuFlyout.Items.Add(menuFlyoutItem);
74+
menuFlyoutItem.Click += (sender, e) => breadcrumbBar.RaiseItemClickedEvent(item);
7375
}
74-
75-
// Open the ellipsis flyout
76-
FlyoutBase.ShowAttachedFlyout(_itemContentButton);
77-
}
78-
else
79-
{
80-
// Fire a click event
81-
breadcrumbBar.RaiseItemClickedEvent(this);
8276
}
77+
78+
// Open the ellipsis flyout
79+
FlyoutBase.ShowAttachedFlyout(_itemContentButton);
80+
}
81+
else
82+
{
83+
// Fire a click event
84+
breadcrumbBar.RaiseItemClickedEvent(this);
8385
}
8486
}
8587

0 commit comments

Comments
 (0)