Portable Tool for an Ideal Windows Setup
C# activatorbloatware-removalcsharpdebloatdebloaterdisable-servicesmonitoring-systemportableprivacy-toolsregistry-tweakssystem-tuningsystem-utilitytelemetrytweakerwindows-10windows-11windows-debloatwindows-defenderwindows-optimizationwindows-tweaks
upd button styles without shaders & optimization flowpanel
Greedeks999f63dc46d3
diff --git a/.Source/GTweak/Assets/UserControls/FileCard.xaml b/.Source/GTweak/Assets/UserControls/FileCard.xamlindex 0e9953e3..0b0e830f 100644--- a/.Source/GTweak/Assets/UserControls/FileCard.xaml+++ b/.Source/GTweak/Assets/UserControls/FileCard.xaml@@ -6,7 +6,7 @@xmlns:local="clr-namespace:GTweak.Assets.UserControls"mc:Ignorable="d"d:Height="Auto" d:Width="Auto" IsTabStop="False" Focusable="False" KeyboardNavigation.TabNavigation="None" SnapsToDevicePixels="True"- UseLayoutRounding="True" Cursor="Hand" MaxWidth="200" >+ x:Name="root" UseLayoutRounding="True" Cursor="Hand" MaxWidth="200" ><Grid Cursor="Hand"><ProgressBar x:Name="ProgressBar" Height="4" Margin="8,0,8,0" Width="Auto" VerticalAlignment="Top" Visibility="Collapsed" Value="0" Maximum="100" Foreground="{StaticResource Brush_Accent}" />@@ -24,10 +24,10 @@</Grid.RowDefinitions><Viewbox Grid.Row="0" Width="50" Height="50" Stretch="Uniform" HorizontalAlignment="Center" VerticalAlignment="Center">- <Image Source="{Binding IconSource, RelativeSource={RelativeSource AncestorType=local:FileCard}, TargetNullValue={StaticResource Img_BatFile}}" Stretch="Uniform"/>+ <Image Source="{Binding IconSource,ElementName=root, TargetNullValue={StaticResource Img_BatFile}}" Stretch="Uniform"/></Viewbox>- <TextBlock Grid.Row="1" Margin="0,15,0,0" FontSize="13px" FontFamily="{StaticResource Jura}" Foreground="{StaticResource Brush_Highlighted}" Text="{Binding FileName, RelativeSource={RelativeSource AncestorType=local:FileCard}}"+ <TextBlock Grid.Row="1" Margin="0,15,0,0" FontSize="13px" FontFamily="{StaticResource Jura}" Foreground="{StaticResource Brush_Highlighted}" Text="{Binding FileName,ElementName=root}"TextWrapping="Wrap" TextAlignment="Center" VerticalAlignment="Top" HorizontalAlignment="Center" MaxWidth="150" MaxHeight="200" TextTrimming="CharacterEllipsis"/></Grid></Border>diff --git a/.Source/GTweak/Assets/UserControls/FlowPanel.cs b/.Source/GTweak/Assets/UserControls/FlowPanel.csindex 251eec3a..714fd938 100644--- a/.Source/GTweak/Assets/UserControls/FlowPanel.cs+++ b/.Source/GTweak/Assets/UserControls/FlowPanel.cs@@ -89,16 +89,15 @@ namespace GTweak.Assets.UserControlsset => SetValue(ResponsiveModeProperty, value);}- private List<FlowItemGroup> _cachedLayout = new List<FlowItemGroup>();+ private List<FlowItemGroup> _cachedLayout;private readonly List<UIElement> _visibleCache = new List<UIElement>();private readonly Stack<FlowItemGroup> _groupPool = new Stack<FlowItemGroup>();private readonly Stack<List<FlowItemGroup>> _listPool = new Stack<List<FlowItemGroup>>();private double[] _heightCache = new double[32];private double _cachedMeasureWidth = -1;- private double GetChildWidth(UIElement child) => EqualizeItemSize ? ItemWidth : child?.DesiredSize.Width ?? 0;-- private double GetChildHeight(UIElement child) => child?.DesiredSize.Height ?? 0;+ private double GetChildWidth(UIElement child) => EqualizeItemSize ? ItemWidth : child.DesiredSize.Width;+ private double GetChildHeight(UIElement child) => child.DesiredSize.Height;private FlowItemGroup GetGroup(){@@ -110,6 +109,7 @@ namespace GTweak.Assets.UserControlsgroup.Height = 0;return group;}+return new FlowItemGroup();}@@ -157,7 +157,6 @@ namespace GTweak.Assets.UserControlsprivate double GetResponsiveAlignmentOffset(double outerWidth, double contentWidth){double extra = Math.Max(0, outerWidth - contentWidth);-return ContentAlignment switch{HorizontalAlignment.Center => extra / 2.0,@@ -179,8 +178,7 @@ namespace GTweak.Assets.UserControlsdouble aw = availableSize.Width;double ah = availableSize.Height;-- double finiteAw = (double.IsInfinity(aw) || double.IsNaN(aw) || aw <= 0) ? (double)(double.IsInfinity(MaxWidth) ? 320.0 : MaxWidth) : aw;+ double finiteAw = (double.IsInfinity(aw) || double.IsNaN(aw) || aw <= 0) ? (double.IsInfinity(MaxWidth) ? 320.0 : MaxWidth) : aw;double totalItemWidth = 0;double maxItemHeight = 0;@@ -189,20 +187,22 @@ namespace GTweak.Assets.UserControlsif (ResponsiveMode){+ Size infSize = new Size(finiteAw, double.PositiveInfinity);+for (int i = 1; i < count; i++){- _visibleCache[i]?.Measure(new Size(finiteAw, double.PositiveInfinity));+ _visibleCache[i].Measure(infSize);}if (count > 1){double lastChildWidth = _visibleCache[count - 1].DesiredSize.Width;double firstMaxWidth = Math.Max(0, finiteAw - lastChildWidth - HorizontalSpacing - 30.0);- _visibleCache[0]?.Measure(new Size(firstMaxWidth, double.PositiveInfinity));+ _visibleCache[0].Measure(new Size(firstMaxWidth, double.PositiveInfinity));}else{- _visibleCache[0]?.Measure(new Size(finiteAw, double.PositiveInfinity));+ _visibleCache[0].Measure(infSize);}}else@@ -210,7 +210,7 @@ namespace GTweak.Assets.UserControlsSize constraint = EqualizeItemSize ? new Size(ItemWidth, double.PositiveInfinity) : new Size(finiteAw, double.PositiveInfinity);for (int i = 0; i < count; i++){- _visibleCache[i]?.Measure(constraint);+ _visibleCache[i].Measure(constraint);}}@@ -233,14 +233,16 @@ namespace GTweak.Assets.UserControlsif (ResponsiveMode){- if (_cachedLayout != null) { ReleaseGroups(_cachedLayout); _cachedLayout = null; }+ if (_cachedLayout != null)+ {+ ReleaseGroups(_cachedLayout);+ _cachedLayout = null;+ }double horizontalRequired = totalItemWidth + (count > 1 ? 30.0 : 0) + (count > 2 ? (count - 2) * HorizontalSpacing : 0);-double verticalRequired = (count > 1) ? Math.Max(totalVerticalHeight - _visibleCache[count - 1].DesiredSize.Height + (count - 2) * VerticalSpacing, _visibleCache[count - 1].DesiredSize.Height) : totalVerticalHeight;Size resultSize = (horizontalRequired <= aw || double.IsInfinity(aw)) ? new Size(double.IsInfinity(aw) ? horizontalRequired : aw, maxItemHeight) : new Size(double.IsInfinity(aw) ? maxItemWidth : aw, verticalRequired);-_cachedMeasureWidth = resultSize.Width;return resultSize;}@@ -248,22 +250,16 @@ namespace GTweak.Assets.UserControlsif (_cachedLayout != null){ReleaseGroups(_cachedLayout);- _cachedLayout = null;}_cachedLayout = CreateOptimalColumns(aw, ah, _visibleCache);double finalHeight = CalculateLayoutHeight(_cachedLayout);double finalWidth = double.IsInfinity(aw) ? CalculateTotalWidth(_cachedLayout) : aw;-_cachedMeasureWidth = finalWidth;return new Size(finalWidth, finalHeight);}- catch (Exception ex)- {- ErrorLogging.LogDebug(ex);- return new Size(0, 0);- }+ catch (Exception) { return new Size(0, 0); }}private void ArrangeResponsive(Size finalSize)@@ -291,7 +287,7 @@ namespace GTweak.Assets.UserControlsdouble availableLeftWidth = Math.Max(0, width - lastChildWidth - HorizontalSpacing);for (int i = 0; i < count; i++){- var child = _visibleCache[i];+ UIElement child = _visibleCache[i];double w = child.DesiredSize.Width;double h = child.DesiredSize.Height;double y = Math.Max(0, (finalSize.Height - h) / 2.0);@@ -313,7 +309,7 @@ namespace GTweak.Assets.UserControlsdouble y = 0;for (int i = 0; i < count; i++){- var child = _visibleCache[i];+ UIElement child = _visibleCache[i];double w = child.DesiredSize.Width;double h = child.DesiredSize.Height;@@ -337,42 +333,22 @@ namespace GTweak.Assets.UserControls{try{- UpdateVisibleCache();-- if (_visibleCache.Count != 0)+ if (_visibleCache.Count == 0){- if (ResponsiveMode)- {- ArrangeResponsive(finalSize);- return finalSize;- }+ return finalSize;+ }- List<FlowItemGroup> groupsToArrange = null;- bool usedCache = false;+ if (ResponsiveMode)+ {+ ArrangeResponsive(finalSize);+ return finalSize;+ }- if (_cachedLayout != null && Math.Abs(_cachedMeasureWidth - finalSize.Width) < 0.1)- {- groupsToArrange = _cachedLayout;- usedCache = true;- _cachedLayout = null;- }- else- {- groupsToArrange = CreateOptimalColumns(finalSize.Width, finalSize.Height, _visibleCache);- }+ List<FlowItemGroup> groupsToArrange = _cachedLayout;- if (groupsToArrange != null)- {- ArrangeAligned(groupsToArrange, finalSize.Width);- ReleaseGroups(groupsToArrange);- }+ groupsToArrange ??= CreateOptimalColumns(finalSize.Width, finalSize.Height, _visibleCache);- if (!usedCache && _cachedLayout != null)- {- ReleaseGroups(_cachedLayout);- _cachedLayout = null;- }- }+ ArrangeAligned(groupsToArrange, finalSize.Width);return finalSize;}@@ -385,42 +361,42 @@ namespace GTweak.Assets.UserControlsprivate double CalculateLayoutHeight(List<FlowItemGroup> layout){- if (layout == null || layout.Count == 0)+ if (layout != null && layout.Count != 0){- return 0;- }-- double neededHeight = 0;- if (Orientation == FlowOrientation.Horizontal)- {- for (int i = 0; i < layout.Count; i++)+ double neededHeight = 0;+ if (Orientation == FlowOrientation.Horizontal){- neededHeight += layout[i].Height;- if (i > 0)+ for (int i = 0; i < layout.Count; i++){- neededHeight += VerticalSpacing;+ neededHeight += layout[i].Height;+ if (i > 0)+ {+ neededHeight += VerticalSpacing;+ }}}+ else+ {+ neededHeight = CalculateMaxColumnHeight(layout);+ }++ return neededHeight;}- else- {- neededHeight = CalculateMaxColumnHeight(layout);- }- return neededHeight;++ return 0;}private void ArrangeAligned(List<FlowItemGroup> groups, double availableWidth){if (groups != null && groups.Count != 0){- switch (Orientation)+ if (Orientation == FlowOrientation.Horizontal)+ {+ ArrangeHorizontal(groups, availableWidth);+ }+ else{- case FlowOrientation.Horizontal:- ArrangeHorizontal(groups, availableWidth);- break;- default:- ArrangeVertical(groups, availableWidth);- break;+ ArrangeVertical(groups, availableWidth);}}}@@ -431,12 +407,9 @@ namespace GTweak.Assets.UserControlsfor (int i = 0; i < groups.Count; i++){FlowItemGroup row = groups[i];- if (row == null || row.Elements.Count == 0)+ if (row.Elements.Count == 0){- if (row != null)- {- y += row.Height + VerticalSpacing;- }+ y += row.Height + VerticalSpacing;continue;}@@ -450,103 +423,83 @@ namespace GTweak.Assets.UserControlsforeach (UIElement child in row.Elements){- if (child != null)- {- double w = GetChildWidth(child);- double h = GetChildHeight(child);-- child.Arrange(new Rect(x, y, w, h));- x += w + HorizontalSpacing;- }+ double w = GetChildWidth(child);+ double h = GetChildHeight(child);+ child.Arrange(new Rect(x, y, w, h));+ x += w + HorizontalSpacing;}-y += row.Height + VerticalSpacing;}}private void ArrangeVertical(List<FlowItemGroup> groups, double availableWidth){- if (groups != null && groups.Count != 0)+ double totalColumnsWidth = 0;+ for (int i = 0; i < groups.Count; i++){- double totalColumnsWidth = 0;- for (int i = 0; i < groups.Count; i++)+ totalColumnsWidth += groups[i].Width;+ if (i < groups.Count - 1){- totalColumnsWidth += groups[i].Width;- if (i < groups.Count - 1)- {- totalColumnsWidth += HorizontalSpacing;- }+ totalColumnsWidth += HorizontalSpacing;}+ }- double extraSpace = Math.Max(0, availableWidth - totalColumnsWidth);-- double xV = ContentAlignment switch- {- HorizontalAlignment.Center => extraSpace / 2.0,- HorizontalAlignment.Right => extraSpace,- _ => 0- };-- for (int i = 0; i < groups.Count; i++)- {- FlowItemGroup col = groups[i];-- double shift = 0;- if (!EqualizeItemSize && groups.Count > 1)- {- shift = extraSpace * ((double)i / (groups.Count - 1)) * 0.3;- }-- double columnX = xV + shift;- double y = 0;+ double extraSpace = Math.Max(0, availableWidth - totalColumnsWidth);+ double xV = ContentAlignment switch+ {+ HorizontalAlignment.Center => extraSpace / 2.0,+ HorizontalAlignment.Right => extraSpace,+ _ => 0+ };- foreach (UIElement child in col.Elements)- {- double w = GetChildWidth(child);- double h = GetChildHeight(child);+ for (int i = 0; i < groups.Count; i++)+ {+ FlowItemGroup col = groups[i];+ double shift = (!EqualizeItemSize && groups.Count > 1) ? (extraSpace * ((double)i / (groups.Count - 1)) * 0.3) : 0;- child.Arrange(new Rect(columnX, y, w, h));- y += h + VerticalSpacing;- }+ double columnX = xV + shift;+ double y = 0;- xV += col.Width + HorizontalSpacing;+ foreach (UIElement child in col.Elements)+ {+ double w = GetChildWidth(child);+ double h = GetChildHeight(child);+ child.Arrange(new Rect(columnX, y, w, h));+ y += h + VerticalSpacing;}+ xV += col.Width + HorizontalSpacing;}}private double CalculateMaxColumnHeight(List<FlowItemGroup> columns){- if (columns == null || columns.Count == 0)- {- return 0;- }-double max = 0;for (int i = 0; i < columns.Count; i++){- if (columns[i] != null && columns[i].Height > max)+ if (columns[i].Height > max){max = columns[i].Height;}}+return max;}private List<FlowItemGroup> CreateOptimalColumns(double availableWidth, double availableHeight, List<UIElement> visibleChildren){- if (visibleChildren == null || visibleChildren.Count == 0)+ if (visibleChildren.Count == 0){return GetGroupList();}- switch (Orientation)+ if (Orientation == FlowOrientation.Horizontal)+ {+ return CreateWrappedRows(availableWidth, visibleChildren);+ }++ if (Orientation == FlowOrientation.Vertical){- case FlowOrientation.Horizontal:- return CreateWrappedRows(availableWidth, visibleChildren);- case FlowOrientation.Vertical:- return CreateWrappedColumns(availableHeight, visibleChildren);- default:- break;+ return CreateWrappedColumns(availableHeight, visibleChildren);}double basisWidth;@@ -575,16 +528,11 @@ namespace GTweak.Assets.UserControlsfor (int columnCount = Math.Min(maxPossibleColumns, visibleChildren.Count); columnCount >= 1; columnCount--){List<FlowItemGroup> columns = TryDistributeToColumns(columnCount, availableHeight, visibleChildren);-if (columns != null && columns.Count > 0 && CalculateTotalWidth(columns) <= availableWidth){return columns;}-- if (columns != null)- {- ReleaseGroups(columns);- }+ ReleaseGroups(columns);}return CreateSingleColumn(visibleChildren);@@ -593,98 +541,84 @@ namespace GTweak.Assets.UserControlsprivate List<FlowItemGroup> CreateWrappedRows(double maxWidth, List<UIElement> visibleChildren){List<FlowItemGroup> rows = GetGroupList();- if (visibleChildren == null)- {- return rows;- }-FlowItemGroup current = null;for (int i = 0; i < visibleChildren.Count; i++){UIElement child = visibleChildren[i];- if (child != null)- {- double childWidth = GetChildWidth(child);- double childHeight = GetChildHeight(child);+ double childWidth = GetChildWidth(child);+ double childHeight = GetChildHeight(child);- if (current == null)- {- current = GetGroup();- current.Elements.Add(child);- current.Width = childWidth;- current.Height = childHeight;- rows.Add(current);- continue;- }+ if (current == null)+ {+ current = GetGroup();+ current.Elements.Add(child);+ current.Width = childWidth;+ current.Height = childHeight;+ rows.Add(current);+ continue;+ }- double widthIfAdded = current.Width + (current.Width > 0 ? HorizontalSpacing : 0) + childWidth;+ double widthIfAdded = current.Width + (current.Width > 0 ? HorizontalSpacing : 0) + childWidth;- if (widthIfAdded <= maxWidth || current.Elements.Count == 0)- {- current.Elements.Add(child);- current.Width = widthIfAdded;- current.Height = Math.Max(current.Height, childHeight);- }- else- {- current = GetGroup();- current.Elements.Add(child);- current.Width = childWidth;- current.Height = childHeight;- rows.Add(current);- }+ if (widthIfAdded <= maxWidth || current.Elements.Count == 0)+ {+ current.Elements.Add(child);+ current.Width = widthIfAdded;+ current.Height = Math.Max(current.Height, childHeight);+ }+ else+ {+ current = GetGroup();+ current.Elements.Add(child);+ current.Width = childWidth;+ current.Height = childHeight;+ rows.Add(current);}}+return rows;}private List<FlowItemGroup> CreateWrappedColumns(double maxHeight, List<UIElement> visibleChildren){List<FlowItemGroup> cols = GetGroupList();- if (visibleChildren == null)- {- return cols;- }-FlowItemGroup current = null;for (int i = 0; i < visibleChildren.Count; i++){UIElement child = visibleChildren[i];- if (child != null)- {- double childWidth = GetChildWidth(child);- double childHeight = GetChildHeight(child);+ double childWidth = GetChildWidth(child);+ double childHeight = GetChildHeight(child);- if (current == null)- {- current = GetGroup();- current.Elements.Add(child);- current.Width = childWidth;- current.Height = childHeight;- cols.Add(current);- continue;- }+ if (current == null)+ {+ current = GetGroup();+ current.Elements.Add(child);+ current.Width = childWidth;+ current.Height = childHeight;+ cols.Add(current);+ continue;+ }- double heightIfAdded = current.Height + (current.Height > 0 ? VerticalSpacing : 0) + childHeight;+ double heightIfAdded = current.Height + (current.Height > 0 ? VerticalSpacing : 0) + childHeight;- if (heightIfAdded <= maxHeight || current.Elements.Count == 0)- {- current.Elements.Add(child);- current.Height = heightIfAdded;- current.Width = Math.Max(current.Width, childWidth);- }- else- {- current = GetGroup();- current.Elements.Add(child);- current.Width = childWidth;- current.Height = childHeight;- cols.Add(current);- }+ if (heightIfAdded <= maxHeight || current.Elements.Count == 0)+ {+ current.Elements.Add(child);+ current.Height = heightIfAdded;+ current.Width = Math.Max(current.Width, childWidth);+ }+ else+ {+ current = GetGroup();+ current.Elements.Add(child);+ current.Width = childWidth;+ current.Height = childHeight;+ cols.Add(current);}}+return cols;}@@ -696,49 +630,40 @@ namespace GTweak.Assets.UserControlscolumns.Add(GetGroup());}- if (visibleChildren == null)- {- return columns;- }-if (UseMasonryLayout){if (_heightCache.Length < columnCount){Array.Resize(ref _heightCache, Math.Max(_heightCache.Length * 2, columnCount));}-Array.Clear(_heightCache, 0, columnCount);for (int c = 0; c < visibleChildren.Count; c++){UIElement child = visibleChildren[c];- if (child != null)+ int minIndex = 0;+ double minH = _heightCache[0];+ for (int i = 1; i < columnCount; i++){- int minIndex = 0;- double minH = _heightCache[0];- for (int i = 1; i < columnCount; i++)+ if (_heightCache[i] < minH){- if (_heightCache[i] < minH)- {- minH = _heightCache[i];- minIndex = i;- }+ minH = _heightCache[i];+ minIndex = i;}+ }- double h = GetChildHeight(child);- double newHeight = _heightCache[minIndex] + (_heightCache[minIndex] > 0 ? VerticalSpacing : 0) + h;+ double h = GetChildHeight(child);+ double newHeight = _heightCache[minIndex] + (_heightCache[minIndex] > 0 ? VerticalSpacing : 0) + h;- if (!double.IsInfinity(maxHeight) && newHeight > maxHeight)- {- ReleaseGroups(columns);- return null;- }-- columns[minIndex].Elements.Add(child);- columns[minIndex].Width = Math.Max(columns[minIndex].Width, GetChildWidth(child));- _heightCache[minIndex] = newHeight;+ if (!double.IsInfinity(maxHeight) && newHeight > maxHeight)+ {+ ReleaseGroups(columns);+ return null;}++ columns[minIndex].Elements.Add(child);+ columns[minIndex].Width = Math.Max(columns[minIndex].Width, GetChildWidth(child));+ _heightCache[minIndex] = newHeight;}for (int i = 0; i < columnCount; i++)@@ -751,23 +676,20 @@ namespace GTweak.Assets.UserControlsfor (int index = 0; index < visibleChildren.Count; index++){UIElement child = visibleChildren[index];- if (child != null)- {- int colIndex = index % columnCount;-- double addedHeight = (columns[colIndex].Height > 0 ? VerticalSpacing : 0) + GetChildHeight(child);- double newHeight = columns[colIndex].Height + addedHeight;+ int colIndex = index % columnCount;- if (!double.IsInfinity(maxHeight) && newHeight > maxHeight)- {- ReleaseGroups(columns);- return null;- }+ double addedHeight = (columns[colIndex].Height > 0 ? VerticalSpacing : 0) + GetChildHeight(child);+ double newHeight = columns[colIndex].Height + addedHeight;- columns[colIndex].Elements.Add(child);- columns[colIndex].Width = Math.Max(columns[colIndex].Width, GetChildWidth(child));- columns[colIndex].Height = newHeight;+ if (!double.IsInfinity(maxHeight) && newHeight > maxHeight)+ {+ ReleaseGroups(columns);+ return null;}++ columns[colIndex].Elements.Add(child);+ columns[colIndex].Width = Math.Max(columns[colIndex].Width, GetChildWidth(child));+ columns[colIndex].Height = newHeight;}}@@ -780,27 +702,21 @@ namespace GTweak.Assets.UserControlsFlowItemGroup col = GetGroup();double totalHeight = 0;- if (visibleChildren != null)+ for (int i = 0; i < visibleChildren.Count; i++){- for (int i = 0; i < visibleChildren.Count; i++)+ UIElement child = visibleChildren[i];+ col.Elements.Add(child);+ col.Width = Math.Max(col.Width, GetChildWidth(child));+ totalHeight += GetChildHeight(child);+ if (i > 0){- UIElement child = visibleChildren[i];- if (child != null)- {- col.Elements.Add(child);- col.Width = Math.Max(col.Width, GetChildWidth(child));- totalHeight += GetChildHeight(child);-- if (i > 0)- {- totalHeight += VerticalSpacing;- }- }+ totalHeight += VerticalSpacing;}}col.Height = totalHeight;list.Add(col);+return list;}@@ -811,26 +727,17 @@ namespace GTweak.Assets.UserControlsdouble total = 0;for (int i = 0; i < columns.Count; i++){- if (columns[i] != null)+ total += columns[i].Width;+ if (i > 0){- total += columns[i].Width;- if (i > 0)- {- total += HorizontalSpacing;- }+ total += HorizontalSpacing;}}+return total;}return 0;}-- protected override void OnVisualChildrenChanged(DependencyObject visualAdded, DependencyObject visualRemoved)- {- base.OnVisualChildrenChanged(visualAdded!, visualRemoved!);- InvalidateMeasure();- InvalidateArrange();- }}}\ No newline at end of filediff --git a/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml b/.Source/GTweak/Assets/UserControls/ToolsetCard.xamlindex 3f7baf24..3470fd85 100644--- a/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml+++ b/.Source/GTweak/Assets/UserControls/ToolsetCard.xaml@@ -7,7 +7,7 @@xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"mc:Ignorable="d"d:Height="auto" d:Width="auto" IsTabStop="False" Focusable="False" KeyboardNavigation.TabNavigation="None"- SnapsToDevicePixels="True" UseLayoutRounding="True">+ x:Name="root" SnapsToDevicePixels="True" UseLayoutRounding="True"><Grid HorizontalAlignment="Left"><Border CornerRadius="8" Opacity="0.5" Background="{StaticResource Brush_ShadowOverlay}" IsHitTestVisible="False" HorizontalAlignment="Center" VerticalAlignment="Top" Width="{Binding ActualWidth, ElementName=CardBody}" Height="{Binding ActualHeight, ElementName=CardBody}"><Border.RenderTransform>@@ -34,8 +34,8 @@<ColumnDefinition Width="*" /></Grid.ColumnDefinitions>- <Image Grid.Column="0" x:Name="CardIcon" Height="35" Width="35" Source="{Binding AppIcon, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Stretch="Uniform"/>- <TextBlock Grid.Column="1" x:Name="CardTitle" Margin="10,0,0,0" Text="{Binding AppName, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Highlighted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"/>+ <Image Grid.Column="0" x:Name="CardIcon" Height="35" Width="35" Source="{Binding AppIcon,ElementName=root}" Stretch="Uniform"/>+ <TextBlock Grid.Column="1" x:Name="CardTitle" Margin="10,0,0,0" Text="{Binding AppName,ElementName=root}" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Highlighted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"/></Grid><Grid VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0,0,15,0">@@ -52,14 +52,14 @@<Style TargetType="Border"><Setter Property="CornerRadius" Value="50"/><Style.Triggers>- <DataTrigger Binding="{Binding IsSquareIcon, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="True">+ <DataTrigger Binding="{Binding IsSquareIcon,ElementName=root}" Value="True"><Setter Property="CornerRadius" Value="5"/></DataTrigger></Style.Triggers></Style></Border.Style><Border.Background>- <ImageBrush ImageSource="{Binding AuthorIcon, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Stretch="Uniform"/>+ <ImageBrush ImageSource="{Binding AuthorIcon,ElementName=root}" Stretch="Uniform"/></Border.Background></Border>@@ -68,7 +68,7 @@<Style TargetType="Path"><Setter Property="Visibility" Value="Visible"/><Style.Triggers>- <DataTrigger Binding="{Binding IsSquareIcon, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="True">+ <DataTrigger Binding="{Binding IsSquareIcon,ElementName=root}" Value="True"><Setter Property="Visibility" Value="Collapsed"/></DataTrigger></Style.Triggers>@@ -84,7 +84,7 @@<Style TargetType="Path"><Setter Property="Visibility" Value="Collapsed"/><Style.Triggers>- <DataTrigger Binding="{Binding IsSquareIcon, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="True">+ <DataTrigger Binding="{Binding IsSquareIcon,ElementName=root}" Value="True"><Setter Property="Visibility" Value="Visible"/></DataTrigger></Style.Triggers>@@ -96,7 +96,7 @@</Path></Grid>- <TextBlock Grid.Column="1" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Inactive}" Text="{Binding AuthorName, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" VerticalAlignment="Center" Margin="5,0,0,0" TextTrimming="CharacterEllipsis"/>+ <TextBlock Grid.Column="1" Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Inactive}" Text="{Binding AuthorName,ElementName=root}" VerticalAlignment="Center" Margin="5,0,0,0" TextTrimming="CharacterEllipsis"/><TextBlock Grid.Column="2" Text=" • " Style="{StaticResource TextDefault}" Foreground="{StaticResource Brush_Inactive}" VerticalAlignment="Center" Margin="5,0,5,0"/>@@ -125,12 +125,12 @@<Grid VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,3,0,0">- <Button x:Name="CardButton" Content="{DynamicResource btn_download}" Command="{Binding DownloadCommand, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}">+ <Button x:Name="CardButton" Content="{DynamicResource btn_download}" Command="{Binding DownloadCommand,ElementName=root}"><Button.Style><Style TargetType="Button" BasedOn="{StaticResource ButtonContent}"><Setter Property="Visibility" Value="Visible"/><Style.Triggers>- <DataTrigger Binding="{Binding IsDownloading, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="True">+ <DataTrigger Binding="{Binding IsDownloading,ElementName=root}" Value="True"><Setter Property="Visibility" Value="Collapsed"/></DataTrigger></Style.Triggers>@@ -143,7 +143,7 @@<Style TargetType="Grid"><Setter Property="Visibility" Value="Collapsed"/><Style.Triggers>- <DataTrigger Binding="{Binding IsDownloading, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="True">+ <DataTrigger Binding="{Binding IsDownloading,ElementName=root}" Value="True"><Setter Property="Visibility" Value="Visible"/></DataTrigger></Style.Triggers>@@ -161,7 +161,7 @@<Style TargetType="TextBlock" BasedOn="{StaticResource TextDefault}"><Setter Property="Visibility" Value="Collapsed"/><Style.Triggers>- <DataTrigger Binding="{Binding Progress, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="0">+ <DataTrigger Binding="{Binding Progress,ElementName=root}" Value="0"><Setter Property="Visibility" Value="Visible"/></DataTrigger></Style.Triggers>@@ -175,19 +175,19 @@<Style TargetType="Grid"><Setter Property="Visibility" Value="Visible"/><Style.Triggers>- <DataTrigger Binding="{Binding Progress, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Value="0">+ <DataTrigger Binding="{Binding Progress,ElementName=root}" Value="0"><Setter Property="Visibility" Value="Collapsed"/></DataTrigger></Style.Triggers></Style></Grid.Style>- <TextBlock Panel.ZIndex="5" Text="{Binding Progress, StringFormat='{}{0:0}%', RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Style="{StaticResource TextDefault}" FontFamily="{StaticResource Play}" Foreground="{StaticResource Brush_Highlighted_Inverted}" FontSize="12px" HorizontalAlignment="Center" VerticalAlignment="Center"/>- <ProgressBar Value="{Binding Progress, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Foreground="{StaticResource Brush_Accent}" Minimum="0" Maximum="100" Height="20" MinWidth="150" VerticalAlignment="Center"/>+ <TextBlock Panel.ZIndex="5" Text="{Binding Progress, StringFormat='{}{0:0}%',ElementName=root}" Style="{StaticResource TextDefault}" FontFamily="{StaticResource Play}" Foreground="{StaticResource Brush_Highlighted_Inverted}" FontSize="12px" HorizontalAlignment="Center" VerticalAlignment="Center"/>+ <ProgressBar Value="{Binding Progress,ElementName=root}" Foreground="{StaticResource Brush_Accent}" Minimum="0" Maximum="100" Height="20" MinWidth="150" VerticalAlignment="Center"/></Grid></Grid>- <Button Grid.Column="1" Content="{DynamicResource btn_cancel}" Style="{StaticResource ButtonContent_Inverted}" Command="{Binding CancelCommand, RelativeSource={RelativeSource AncestorType=local:ToolsetCard}}" Margin="10,0,0,0"/>+ <Button Grid.Column="1" Content="{DynamicResource btn_cancel}" Style="{StaticResource ButtonContent_Inverted}" Command="{Binding CancelCommand,ElementName=root}" Margin="10,0,0,0"/></Grid></Grid>diff --git a/.Source/GTweak/GTweak.csproj b/.Source/GTweak/GTweak.csprojindex 8f387b2f..c1e338c5 100644--- a/.Source/GTweak/GTweak.csproj+++ b/.Source/GTweak/GTweak.csproj@@ -134,7 +134,6 @@<Compile Include="Assets\UserControls\ColorPicker.xaml.cs"><DependentUpon>ColorPicker.xaml</DependentUpon></Compile>- <Compile Include="Assets\ShaderEffects\ColorWheelEffect.cs" /><Compile Include="Assets\UserControls\DescriptionBlock.xaml.cs"><DependentUpon>DescriptionBlock.xaml</DependentUpon></Compile>@@ -145,6 +144,7 @@<Compile Include="Assets\UserControls\ToolsetCard.xaml.cs"><DependentUpon>ToolsetCard.xaml</DependentUpon></Compile>+ <Compile Include="Assets\ShaderEffects\ColorWheelEffect.cs" /><Compile Include="Core\Base\IViewPageBase.cs" /><Compile Include="Core\Base\ViewModelPageBase.cs" /><Compile Include="Core\Converters\AngleToPercentConverter.cs" />diff --git a/.Source/GTweak/Styles/Buttons/Buttons.xaml b/.Source/GTweak/Styles/Buttons/Buttons.xamlindex ba49cd0d..429ffbe9 100644--- a/.Source/GTweak/Styles/Buttons/Buttons.xaml+++ b/.Source/GTweak/Styles/Buttons/Buttons.xaml@@ -1,5 +1,6 @@<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"+ xmlns:effect="clr-namespace:GTweak.Assets.ShaderEffects"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"><Style x:Key="TitleButtonBase" TargetType="Control">@@ -133,53 +134,45 @@</Setter.Value></Setter></Style>-- <Style x:Key="ButtonContent" TargetType="{x:Type Button}">- <Setter Property="Foreground" Value="{StaticResource Brush_Highlighted}"/>- <Setter Property="Background" Value="{StaticResource Brush_Button}"/>++ <Style x:Key="BaseButtonStyle" TargetType="{x:Type Button}"><Setter Property="FontFamily" Value="{StaticResource Jura}"/><Setter Property="FontWeight" Value="Normal"/><Setter Property="Cursor" Value="Hand"/>- <Setter Property="KeyboardNavigation.TabNavigation" Value="None"/><Setter Property="FocusVisualStyle" Value="{x:Null}" /><Setter Property="Focusable" Value="False"/>- <Setter Property="IsTabStop" Value="False"/><Setter Property="Padding" Value="12,6"/>+ <Setter Property="HorizontalContentAlignment" Value="Center"/>+ <Setter Property="VerticalContentAlignment" Value="Center"/><Setter Property="Template"><Setter.Value><ControlTemplate TargetType="{x:Type Button}">- <Grid x:Name="Root" RenderTransformOrigin="0.5,0.5" RenderOptions.BitmapScalingMode="HighQuality">- <Grid.CacheMode>- <BitmapCache RenderAtScale="2" EnableClearType="True"/>- </Grid.CacheMode>- <Grid.RenderTransform>- <ScaleTransform ScaleX="1" ScaleY="1"/>- </Grid.RenderTransform>- <Border x:Name="HoverBorder" CornerRadius="7" Background="{TemplateBinding Background}" Visibility="Hidden"/>- <Border x:Name="MainBorder" CornerRadius="7" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>+ <Grid>+ <ContentPresenter x:Name="RootContent" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}" IsHitTestVisible="False"/>+ <Border Background="{TemplateBinding Background}" CornerRadius="7">+ <Border x:Name="HoverBackground" Background="{TemplateBinding BorderBrush}" CornerRadius="7" Opacity="0" />+ </Border>+ <Border CornerRadius="7" ClipToBounds="True" IsHitTestVisible="False">+ <Rectangle x:Name="ContentView">+ <Rectangle.Fill>+ <VisualBrush x:Name="AnimatedBrush" Visual="{Binding ElementName=RootContent}" Stretch="None" TileMode="Tile" Viewport="0,0,1,1" />+ </Rectangle.Fill>+ </Rectangle></Border></Grid><ControlTemplate.Triggers><Trigger Property="IsMouseOver" Value="True">- <Setter TargetName="HoverBorder" Property="Visibility" Value="Visible"></Setter>- <Setter TargetName="HoverBorder" Property="Effect">- <Setter.Value>- <BlurEffect Radius="5"/>- </Setter.Value>- </Setter>- <Setter Property="Background" Value="{StaticResource Brush_Button_Hover}"/><Trigger.EnterActions><BeginStoryboard><Storyboard Timeline.DesiredFrameRate="120">- <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="RenderTransform.ScaleX" To="1.02" Duration="0:0:0.2">+ <RectAnimation Storyboard.TargetName="AnimatedBrush" Storyboard.TargetProperty="Viewport" To="0,-1,1,1" Duration="0:0:0.9">+ <RectAnimation.EasingFunction>+ <BackEase EasingMode="EaseOut" Amplitude="0.5"/>+ </RectAnimation.EasingFunction>+ </RectAnimation>+ <DoubleAnimation Storyboard.TargetName="HoverBackground" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.4"><DoubleAnimation.EasingFunction>- <CubicEase/>- </DoubleAnimation.EasingFunction>- </DoubleAnimation>- <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="RenderTransform.ScaleY" To="1.02" Duration="0:0:0.2">- <DoubleAnimation.EasingFunction>- <CubicEase/>+ <CubicEase EasingMode="EaseOut"/></DoubleAnimation.EasingFunction></DoubleAnimation></Storyboard>@@ -188,14 +181,14 @@<Trigger.ExitActions><BeginStoryboard><Storyboard Timeline.DesiredFrameRate="120">- <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="0:0:0.2">+ <RectAnimation Storyboard.TargetName="AnimatedBrush" Storyboard.TargetProperty="Viewport" To="0,0,1,1" Duration="0:0:0.8">+ <RectAnimation.EasingFunction>+ <BackEase EasingMode="EaseOut" Amplitude="0.5"/>+ </RectAnimation.EasingFunction>+ </RectAnimation>+ <DoubleAnimation Storyboard.TargetName="HoverBackground" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.4"><DoubleAnimation.EasingFunction>- <CubicEase/>- </DoubleAnimation.EasingFunction>- </DoubleAnimation>- <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="0:0:0.2">- <DoubleAnimation.EasingFunction>- <CubicEase/>+ <CubicEase EasingMode="EaseOut"/></DoubleAnimation.EasingFunction></DoubleAnimation></Storyboard>@@ -208,76 +201,16 @@</Setter></Style>- <Style x:Key="ButtonContent_Inverted" TargetType="{x:Type Button}">+ <Style x:Key="ButtonContent" TargetType="{x:Type Button}" BasedOn="{StaticResource BaseButtonStyle}">+ <Setter Property="Foreground" Value="{StaticResource Brush_Highlighted}"/>+ <Setter Property="Background" Value="{StaticResource Brush_Button}"/>+ <Setter Property="BorderBrush" Value="{StaticResource Brush_Button_Hover}"/>+ </Style>++ <Style x:Key="ButtonContent_Inverted" TargetType="{x:Type Button}" BasedOn="{StaticResource BaseButtonStyle}"><Setter Property="Foreground" Value="{StaticResource Brush_Highlighted_Inverted}"/><Setter Property="Background" Value="{StaticResource Brush_Button_Inverted}"/>- <Setter Property="FontFamily" Value="{StaticResource Jura}"/>- <Setter Property="FontWeight" Value="Normal"/>- <Setter Property="IsTabStop" Value="False"/>- <Setter Property="Cursor" Value="Hand"/>- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>- <Setter Property="Padding" Value="12,6"/>- <Setter Property="Template">- <Setter.Value>- <ControlTemplate TargetType="{x:Type Button}">- <Grid x:Name="Root" RenderTransformOrigin="0.5,0.5" RenderOptions.BitmapScalingMode="HighQuality">- <Grid.CacheMode>- <BitmapCache RenderAtScale="2" EnableClearType="True"/>- </Grid.CacheMode>- <Grid.RenderTransform>- <ScaleTransform ScaleX="1" ScaleY="1"/>- </Grid.RenderTransform>- <Border x:Name="HoverBorder" CornerRadius="7" Background="{TemplateBinding Background}" Visibility="Hidden"/>- <Border x:Name="MainBorder" CornerRadius="7" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>- </Border>- </Grid>- <ControlTemplate.Triggers>- <Trigger Property="IsMouseOver" Value="True">- <Setter TargetName="HoverBorder" Property="Visibility" Value="Visible"></Setter>- <Setter TargetName="HoverBorder" Property="Effect">- <Setter.Value>- <BlurEffect Radius="5"/>- </Setter.Value>- </Setter>- <Setter Property="Background" Value="{StaticResource Brush_Button_Hover_Inverted}"/>- <Trigger.EnterActions>- <BeginStoryboard>- <Storyboard Timeline.DesiredFrameRate="120">- <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="RenderTransform.ScaleX" To="1.02" Duration="0:0:0.2">- <DoubleAnimation.EasingFunction>- <CubicEase/>- </DoubleAnimation.EasingFunction>- </DoubleAnimation>- <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="RenderTransform.ScaleY" To="1.02" Duration="0:0:0.2">- <DoubleAnimation.EasingFunction>- <CubicEase/>- </DoubleAnimation.EasingFunction>- </DoubleAnimation>- </Storyboard>- </BeginStoryboard>- </Trigger.EnterActions>- <Trigger.ExitActions>- <BeginStoryboard>- <Storyboard Timeline.DesiredFrameRate="120">- <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="0:0:0.2">- <DoubleAnimation.EasingFunction>- <CubicEase/>- </DoubleAnimation.EasingFunction>- </DoubleAnimation>- <DoubleAnimation Storyboard.TargetName="Root" Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="0:0:0.2">- <DoubleAnimation.EasingFunction>- <CubicEase/>- </DoubleAnimation.EasingFunction>- </DoubleAnimation>- </Storyboard>- </BeginStoryboard>- </Trigger.ExitActions>- </Trigger>- </ControlTemplate.Triggers>- </ControlTemplate>- </Setter.Value>- </Setter>+ <Setter Property="BorderBrush" Value="{StaticResource Brush_Button_Hover_Inverted}"/></Style>-+</ResourceDictionary>\ No newline at end of filediff --git a/.Source/GTweak/Styles/Themes/Dark/Colors.xaml b/.Source/GTweak/Styles/Themes/Dark/Colors.xamlindex 0ccdc703..5a7da0d6 100644--- a/.Source/GTweak/Styles/Themes/Dark/Colors.xaml+++ b/.Source/GTweak/Styles/Themes/Dark/Colors.xaml@@ -36,7 +36,7 @@<SolidColorBrush x:Key="Brush_Button_Hover" Color="#303231"/><SolidColorBrush x:Key="Brush_Button_Inverted" Color="#ECEBE7"/>- <SolidColorBrush x:Key="Brush_Button_Hover_Inverted" Color="#E0DFDA"/>+ <SolidColorBrush x:Key="Brush_Button_Hover_Inverted" Color="#D9D8D5"/><SolidColorBrush x:Key="Brush_Background_TextBox" Color="#252525"/><SolidColorBrush x:Key="Brush_TextBox_Border" Color="#858685"/>diff --git a/.Source/GTweak/View/ToolsetView.xaml b/.Source/GTweak/View/ToolsetView.xamlindex 6e2a3ad0..7c79befb 100644--- a/.Source/GTweak/View/ToolsetView.xaml+++ b/.Source/GTweak/View/ToolsetView.xaml@@ -55,7 +55,7 @@<Grid Grid.Row="2" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"><ScrollViewer VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Disabled"><Grid>- <ItemsControl ItemsSource="{Binding ToolsView}" VirtualizingPanel.IsVirtualizing="True">+ <ItemsControl ItemsSource="{Binding ToolsView}"><ItemsControl.ItemsPanel><ItemsPanelTemplate><uc:FlowPanel Margin="10,10,10,20" HorizontalSpacing="5" VerticalSpacing="10" ContentAlignment="Stretch" HorizontalAlignment="Stretch" VerticalAlignment="Top"/>