Skip to content

Commit

Permalink
Batch resize W.I.P #165
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben2776 committed Nov 27, 2024
1 parent 46025aa commit fc54049
Show file tree
Hide file tree
Showing 10 changed files with 1,873 additions and 1,630 deletions.
23 changes: 23 additions & 0 deletions src/PicView.Avalonia/Converters/IndexBiggerThanBooleanConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Globalization;
using Avalonia.Data;
using Avalonia.Data.Converters;

namespace PicView.Avalonia.Converters;

public class IndexBiggerThanBooleanConverter: IValueConverter
{
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
{
if (!int.TryParse(value?.ToString(), out var index) || !int.TryParse(parameter?.ToString(), out var parameterIndex))
{
return BindingOperations.DoNothing;
}
return index >= parameterIndex;
}

public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
{

return BindingOperations.DoNothing;
}
}
101 changes: 101 additions & 0 deletions src/PicView.Avalonia/PicViewTheme/Controls/ProgressBar.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="using:Avalonia.Controls.Converters"
x:ClassModifier="internal">
<converters:StringFormatConverter x:Key="StringFormatConverter" />

<ControlTheme x:Key="{x:Type ProgressBar}"
TargetType="ProgressBar">
<Setter Property="Background" Value="{DynamicResource AccentColor}" />
<Setter Property="Foreground" Value="{DynamicResource AccentColor}" />
<Setter Property="Template">
<ControlTemplate TargetType="ProgressBar">
<Panel>
<Border Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
CornerRadius="{TemplateBinding CornerRadius}"
Opacity="0.2"/>
<Border Name="PART_Indicator"
Background="{TemplateBinding Foreground}"
IsVisible="{Binding !IsIndeterminate, RelativeSource={RelativeSource TemplatedParent}}" />
<Border Name="PART_IndeterminateIndicator"
Background="{TemplateBinding Foreground}"
IsVisible="{Binding IsIndeterminate, RelativeSource={RelativeSource TemplatedParent}}" />
<LayoutTransformControl Name="PART_LayoutTransformControl"
HorizontalAlignment="Center"
VerticalAlignment="Center"
IsVisible="{Binding ShowProgressText, RelativeSource={RelativeSource TemplatedParent}}">
<TextBlock Foreground="{DynamicResource MainTextColor}">
<TextBlock.Text>
<MultiBinding Converter="{StaticResource StringFormatConverter}">
<TemplateBinding Property="ProgressTextFormat" />
<Binding Path="Value"
RelativeSource="{RelativeSource TemplatedParent}" />
<TemplateBinding Property="Percentage" />
<TemplateBinding Property="Minimum" />
<TemplateBinding Property="Maximum" />
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</LayoutTransformControl>
</Panel>
</ControlTemplate>
</Setter>

<Style Selector="^:horizontal /template/ Border#PART_Indicator">
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="VerticalAlignment" Value="Stretch" />
</Style>
<Style Selector="^:vertical /template/ Border#PART_Indicator">
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Bottom" />
</Style>
<Style Selector="^:horizontal">
<Setter Property="MinWidth" Value="200" />
<Setter Property="MinHeight" Value="16" />
</Style>
<Style Selector="^:vertical">
<Setter Property="MinWidth" Value="16" />
<Setter Property="MinHeight" Value="200" />
</Style>
<Style Selector="^:vertical /template/ LayoutTransformControl#PART_LayoutTransformControl">
<Setter Property="LayoutTransform">
<Setter.Value>
<RotateTransform Angle="90" />
</Setter.Value>
</Setter>
</Style>

<Style Selector="^:horizontal:indeterminate /template/ Border#PART_IndeterminateIndicator">
<Style.Animations>
<Animation Easing="LinearEasing"
IterationCount="Infinite"
Duration="0:0:3">
<KeyFrame Cue="0%">
<Setter Property="TranslateTransform.X" Value="{Binding $parent[ProgressBar].TemplateSettings.IndeterminateStartingOffset}" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="TranslateTransform.X" Value="{Binding $parent[ProgressBar].TemplateSettings.IndeterminateEndingOffset}" />
</KeyFrame>
</Animation>
</Style.Animations>
<Setter Property="Width" Value="{Binding TemplateSettings.ContainerWidth, RelativeSource={RelativeSource TemplatedParent}}" />
</Style>
<Style Selector="^:vertical:indeterminate /template/ Border#PART_IndeterminateIndicator">
<Style.Animations>
<Animation Easing="LinearEasing"
IterationCount="Infinite"
Duration="0:0:3">
<KeyFrame Cue="0%">
<Setter Property="TranslateTransform.Y" Value="{Binding $parent[ProgressBar].TemplateSettings.IndeterminateStartingOffset}" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="TranslateTransform.Y" Value="{Binding $parent[ProgressBar].TemplateSettings.IndeterminateEndingOffset}" />
</KeyFrame>
</Animation>
</Style.Animations>
<Setter Property="Height" Value="{Binding TemplateSettings.ContainerWidth, RelativeSource={RelativeSource TemplatedParent}}" />
</Style>
</ControlTheme>
</ResourceDictionary>
21 changes: 20 additions & 1 deletion src/PicView.Avalonia/PicViewTheme/Icons.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StreamGeometry x:Key="DuplicateGeometry">M448 384H256c-35.3 0-64-28.7-64-64V64c0-35.3 28.7-64 64-64H396.1c12.7 0 24.9 5.1 33.9 14.1l67.9 67.9c9 9 14.1 21.2 14.1 33.9V320c0 35.3-28.7 64-64 64zM64 128h96v48H64c-8.8 0-16 7.2-16 16V448c0 8.8 7.2 16 16 16H256c8.8 0 16-7.2 16-16V416h48v32c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V192c0-35.3 28.7-64 64-64z</StreamGeometry>
<StreamGeometry x:Key="CopyGeometry">M384 336H192c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16l140.1 0L400 115.9V320c0 8.8-7.2 16-16 16zM192 384H384c35.3 0 64-28.7 64-64V115.9c0-12.7-5.1-24.9-14.1-33.9L366.1 14.1c-9-9-21.2-14.1-33.9-14.1H192c-35.3 0-64 28.7-64 64V320c0 35.3 28.7 64 64 64zM64 128c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H256c35.3 0 64-28.7 64-64V416H272v32c0 8.8-7.2 16-16 16H64c-8.8 0-16-7.2-16-16V192c0-8.8 7.2-16 16-16H96V128H64z</StreamGeometry>
<StreamGeometry x:Key="AltFolderGeometry">M384 480h48c11.4 0 21.9-6 27.6-15.9l112-192c5.8-9.9 5.8-22.1 .1-32.1S555.5 224 544 224H144c-11.4 0-21.9 6-27.6 15.9L48 357.1V96c0-8.8 7.2-16 16-16H181.5c4.2 0 8.3 1.7 11.3 4.7l26.5 26.5c21 21 49.5 32.8 79.2 32.8H416c8.8 0 16 7.2 16 16v32h48V160c0-35.3-28.7-64-64-64H298.5c-17 0-33.3-6.7-45.3-18.7L226.7 50.7c-12-12-28.3-18.7-45.3-18.7H64C28.7 32 0 60.7 0 96V416c0 35.3 28.7 64 64 64H87.7 384z</StreamGeometry>
<StreamGeometry x:Key="AltFolderGeometry">M30.718,23.404l0.007-19.877c-0.003-0.611-0.499-1.107-1.109-1.107H15.597 c-0.433-0.01-0.771-0.807-0.771-1.111V1.182c0-0.648-0.528-1.182-1.18-1.182h-7.46C5.535,0,5.008,0.533,5.008,1.182v0.127 c0,0.309-0.341,1.117-0.784,1.117h0.013c-0.604,0.008-1.094,0.5-1.094,1.105l0.005,5.754H0.763c0,0-1.056-0.057-0.683,1.199 l2.516,12.92c0,0.65,0.453,1.176,1.104,1.176h26.474C30.824,24.58,30.718,23.404,30.718,23.404z M29.359,10.949l-0.014,12.975 l-2.502-13.908c-0.212-0.764-1.075-0.711-1.075-0.711H4.51V4.891h24.85V10.949z</StreamGeometry>
<StreamGeometry x:Key="WrenchGeometry">
M393.87 190a32.1 32.1 0 01-45.25 0l-26.57-26.57a32.09 32.09 0 010-45.26L382.19 58a1 1 0 00-.3-1.64c-38.82-16.64-89.15-8.16-121.11 23.57-30.58 30.35-32.32 76-21.12 115.84a31.93 31.93 0 01-9.06 32.08L64 380a48.17 48.17 0 1068 68l153.86-167a31.93 31.93 0 0131.6-9.13c39.54 10.59 84.54 8.6 114.72-21.19 32.49-32 39.5-88.56 23.75-120.93a1 1 0 00-1.6-.26
</StreamGeometry>
Expand Down Expand Up @@ -1010,4 +1010,23 @@
</DrawingGroup>
</DrawingGroup>
</DrawingImage>
<DrawingImage x:Key="PercentageIcon">
<DrawingGroup>
<GeometryDrawing Geometry="F1 M19 5L5 19">
<GeometryDrawing.Pen>
<Pen Brush="{StaticResource SecondaryTextColor}" Thickness="2" LineCap="Round" LineJoin="Round" MiterLimit="4" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Geometry="F1 M9 6.5Q9 6.62282 8.98796 6.74504Q8.97592 6.86727 8.95196 6.98772Q8.928 7.10818 8.89235 7.22571Q8.8567 7.34324 8.8097 7.45671Q8.7627 7.57018 8.7048 7.67849Q8.64691 7.78681 8.57867 7.88892Q8.51044 7.99104 8.43252 8.08598Q8.35461 8.18092 8.26777 8.26777Q8.18092 8.35461 8.08598 8.43252Q7.99104 8.51044 7.88892 8.57867Q7.78681 8.64691 7.67849 8.7048Q7.57018 8.7627 7.45671 8.8097Q7.34324 8.8567 7.22571 8.89235Q7.10818 8.928 6.98773 8.95196Q6.86727 8.97592 6.74504 8.98796Q6.62282 9 6.5 9Q6.37718 9 6.25496 8.98796Q6.13273 8.97592 6.01227 8.95196Q5.89182 8.928 5.77429 8.89235Q5.65676 8.8567 5.54329 8.8097Q5.42982 8.7627 5.32151 8.7048Q5.21319 8.64691 5.11107 8.57867Q5.00896 8.51044 4.91402 8.43252Q4.81908 8.35461 4.73223 8.26777Q4.64539 8.18092 4.56747 8.08598Q4.48956 7.99104 4.42133 7.88892Q4.35309 7.78681 4.2952 7.67849Q4.2373 7.57018 4.1903 7.45671Q4.1433 7.34324 4.10765 7.22571Q4.072 7.10818 4.04804 6.98773Q4.02408 6.86727 4.01204 6.74504Q4 6.62282 4 6.5Q4 6.37718 4.01204 6.25496Q4.02408 6.13273 4.04804 6.01227Q4.072 5.89182 4.10765 5.77429Q4.1433 5.65676 4.1903 5.54329Q4.2373 5.42982 4.2952 5.32151Q4.35309 5.21319 4.42133 5.11107Q4.48956 5.00896 4.56747 4.91402Q4.64539 4.81908 4.73223 4.73223Q4.81908 4.64539 4.91402 4.56747Q5.00896 4.48956 5.11107 4.42133Q5.21319 4.35309 5.32151 4.2952Q5.42982 4.2373 5.54329 4.1903Q5.65676 4.1433 5.77429 4.10765Q5.89182 4.072 6.01227 4.04804Q6.13273 4.02408 6.25496 4.01204Q6.37718 4 6.5 4Q6.62282 4 6.74504 4.01204Q6.86727 4.02408 6.98772 4.04804Q7.10818 4.072 7.22571 4.10765Q7.34324 4.1433 7.45671 4.1903Q7.57018 4.2373 7.67849 4.2952Q7.78681 4.35309 7.88892 4.42133Q7.99104 4.48956 8.08598 4.56747Q8.18092 4.64539 8.26777 4.73223Q8.35461 4.81908 8.43252 4.91402Q8.51044 5.00896 8.57867 5.11107Q8.64691 5.21319 8.7048 5.32151Q8.7627 5.42982 8.8097 5.54329Q8.8567 5.65676 8.89235 5.77429Q8.928 5.89182 8.95196 6.01227Q8.97592 6.13273 8.98796 6.25496Q9 6.37718 9 6.5Z">
<GeometryDrawing.Pen>
<Pen Brush="{StaticResource SecondaryTextColor}" Thickness="2" LineCap="Round" LineJoin="Round" MiterLimit="4" />
</GeometryDrawing.Pen>
</GeometryDrawing>
<GeometryDrawing Geometry="F1 M20 17.5Q20 17.6228 19.988 17.745Q19.9759 17.8673 19.952 17.9877Q19.928 18.1082 19.8924 18.2257Q19.8567 18.3432 19.8097 18.4567Q19.7627 18.5702 19.7048 18.6785Q19.6469 18.7868 19.5787 18.8889Q19.5104 18.991 19.4325 19.086Q19.3546 19.1809 19.2678 19.2678Q19.1809 19.3546 19.086 19.4325Q18.991 19.5104 18.8889 19.5787Q18.7868 19.6469 18.6785 19.7048Q18.5702 19.7627 18.4567 19.8097Q18.3432 19.8567 18.2257 19.8924Q18.1082 19.928 17.9877 19.952Q17.8673 19.9759 17.745 19.988Q17.6228 20 17.5 20Q17.3772 20 17.255 19.988Q17.1327 19.9759 17.0123 19.952Q16.8918 19.928 16.7743 19.8924Q16.6568 19.8567 16.5433 19.8097Q16.4298 19.7627 16.3215 19.7048Q16.2132 19.6469 16.1111 19.5787Q16.009 19.5104 15.914 19.4325Q15.8191 19.3546 15.7322 19.2678Q15.6454 19.1809 15.5675 19.086Q15.4896 18.991 15.4213 18.8889Q15.3531 18.7868 15.2952 18.6785Q15.2373 18.5702 15.1903 18.4567Q15.1433 18.3432 15.1076 18.2257Q15.072 18.1082 15.048 17.9877Q15.0241 17.8673 15.012 17.745Q15 17.6228 15 17.5Q15 17.3772 15.012 17.255Q15.0241 17.1327 15.048 17.0123Q15.072 16.8918 15.1076 16.7743Q15.1433 16.6568 15.1903 16.5433Q15.2373 16.4298 15.2952 16.3215Q15.3531 16.2132 15.4213 16.1111Q15.4896 16.009 15.5675 15.914Q15.6454 15.8191 15.7322 15.7322Q15.8191 15.6454 15.914 15.5675Q16.009 15.4896 16.1111 15.4213Q16.2132 15.3531 16.3215 15.2952Q16.4298 15.2373 16.5433 15.1903Q16.6568 15.1433 16.7743 15.1076Q16.8918 15.072 17.0123 15.048Q17.1327 15.0241 17.255 15.012Q17.3772 15 17.5 15Q17.6228 15 17.745 15.012Q17.8673 15.0241 17.9877 15.048Q18.1082 15.072 18.2257 15.1076Q18.3432 15.1433 18.4567 15.1903Q18.5702 15.2373 18.6785 15.2952Q18.7868 15.3531 18.8889 15.4213Q18.991 15.4896 19.086 15.5675Q19.1809 15.6454 19.2678 15.7322Q19.3546 15.8191 19.4325 15.914Q19.5104 16.009 19.5787 16.1111Q19.6469 16.2132 19.7048 16.3215Q19.7627 16.4298 19.8097 16.5433Q19.8567 16.6568 19.8924 16.7743Q19.928 16.8918 19.952 17.0123Q19.9759 17.1327 19.988 17.255Q20 17.3772 20 17.5Z">
<GeometryDrawing.Pen>
<Pen Brush="{StaticResource SecondaryTextColor}" Thickness="2" LineCap="Round" LineJoin="Round" MiterLimit="4" />
</GeometryDrawing.Pen>
</GeometryDrawing>
</DrawingGroup>
</DrawingImage>
</ResourceDictionary>
1 change: 1 addition & 0 deletions src/PicView.Avalonia/PicViewTheme/Index.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<ResourceInclude Source="Controls/Menu.axaml" />
<ResourceInclude Source="Controls/MenuFlyoutPresenter.axaml" />
<ResourceInclude Source="Controls/PathIcon.axaml" />
<ResourceInclude Source="Controls/ProgressBar.axaml" />
<ResourceInclude Source="Controls/RadioButton.axaml" />
<ResourceInclude Source="Controls/RepeatButton.axaml" />
<ResourceInclude Source="Controls/Scrollbar.axaml" />
Expand Down
8 changes: 1 addition & 7 deletions src/PicView.Avalonia/StartUp/StartUpHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,17 +93,11 @@ public static void Start(MainViewModel vm, bool settingsExists, IClassicDesktopS
HandleNormalWindow(vm, window);
}
}
UIHelper.SetControls(desktop);


UIHelper.SetControls(desktop);
HandleWindowControlSettings(vm, desktop);

ValidateGallerySettings(vm, settingsExists);



SetWindowEventHandlers(window);

UIHelper.AddMenus();

Application.Current.Name = "PicView";
Expand Down
Loading

0 comments on commit fc54049

Please sign in to comment.