-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Image effects window, work in progress
- Loading branch information
Showing
36 changed files
with
1,556 additions
and
671 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<Window | ||
CanResize="False" | ||
ExtendClientAreaChromeHints="SystemChrome" | ||
ExtendClientAreaTitleBarHeightHint="-1" | ||
SizeToContent="WidthAndHeight" | ||
Title="Loading..." | ||
d:DesignHeight="450" | ||
d:DesignWidth="800" | ||
mc:Ignorable="d" | ||
x:Class="PicView.Avalonia.MacOS.Views.EffectsWindow" | ||
x:DataType="viewModels:MainViewModel" | ||
xmlns="https://github.com/avaloniaui" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:viewModels="clr-namespace:PicView.Avalonia.ViewModels;assembly=PicView.Avalonia" | ||
xmlns:views="clr-namespace:PicView.Avalonia.Views;assembly=PicView.Avalonia" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
<Design.DataContext> | ||
<viewModels:MainViewModel /> | ||
</Design.DataContext> | ||
<Border | ||
BorderBrush="{DynamicResource MainBorderColor}" | ||
BorderThickness="1" | ||
CornerRadius="8"> | ||
<Panel> | ||
|
||
<DockPanel | ||
Background="{DynamicResource SecondaryBackgroundColor}" | ||
Height="28" | ||
PointerPressed="MoveWindow" | ||
VerticalAlignment="Top"> | ||
|
||
<TextBlock | ||
Classes="txt" | ||
Text="{CompiledBinding Effects, | ||
Mode=OneWay}" | ||
TextAlignment="Center" /> | ||
</DockPanel> | ||
|
||
<views:EffectsView | ||
Background="{DynamicResource WindowBackgroundColor}" | ||
Margin="0,28,0,0" | ||
Padding="10,5,5,10" | ||
PointerPressed="MoveWindow" | ||
x:Name="XEffectsView" /> | ||
</Panel> | ||
</Border> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using Avalonia.Controls; | ||
using Avalonia.Input; | ||
using Avalonia.Media; | ||
using PicView.Core.Config; | ||
using PicView.Core.Localization; | ||
|
||
namespace PicView.Avalonia.MacOS.Views; | ||
|
||
public partial class EffectsWindow : Window | ||
{ | ||
public EffectsWindow() | ||
{ | ||
InitializeComponent(); | ||
if (!SettingsHelper.Settings.Theme.Dark || SettingsHelper.Settings.Theme.GlassTheme) | ||
{ | ||
XEffectsView.Background = Brushes.Transparent; | ||
} | ||
Loaded += delegate | ||
{ | ||
MinWidth = MaxWidth = Width; | ||
Title = $"{TranslationHelper.Translation.Effects} - PicView"; | ||
}; | ||
KeyDown += (_, e) => | ||
{ | ||
if (e.Key is Key.Escape) | ||
{ | ||
Close(); | ||
} | ||
}; | ||
} | ||
|
||
private void MoveWindow(object? sender, PointerPressedEventArgs e) | ||
{ | ||
if (VisualRoot is null) { return; } | ||
|
||
var hostWindow = (Window)VisualRoot; | ||
hostWindow?.BeginMoveDrag(e); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<Window | ||
BorderThickness="1" | ||
CanResize="False" | ||
CornerRadius="8" | ||
SizeToContent="WidthAndHeight" | ||
Title="Loading..." | ||
x:Class="PicView.Avalonia.Win32.Views.EffectsWindow" | ||
x:DataType="viewModels:MainViewModel" | ||
xmlns="https://github.com/avaloniaui" | ||
xmlns:customControls="clr-namespace:PicView.Avalonia.CustomControls;assembly=PicView.Avalonia" | ||
xmlns:viewModels="clr-namespace:PicView.Avalonia.ViewModels;assembly=PicView.Avalonia" | ||
xmlns:views="clr-namespace:PicView.Avalonia.Views;assembly=PicView.Avalonia" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
<Border | ||
BorderBrush="{DynamicResource WindowBorderColor}" | ||
BorderThickness="1" | ||
PointerPressed="MoveWindow" | ||
x:Name="ParentBorder"> | ||
<StackPanel> | ||
|
||
<DockPanel Height="28" LastChildFill="True"> | ||
|
||
<Border | ||
Background="{DynamicResource WindowButtonBackgroundColor}" | ||
BorderBrush="{DynamicResource MainBorderColor}" | ||
BorderThickness="0,0,1,0" | ||
DockPanel.Dock="Left" | ||
x:Name="IconBorder"> | ||
<Image | ||
Height="25" | ||
Margin="7,1,7,1" | ||
Source="{StaticResource LogoImage}" | ||
Width="20" /> | ||
</Border> | ||
|
||
<customControls:IconButton | ||
Background="{DynamicResource WindowButtonBackgroundColor}" | ||
BorderThickness="0" | ||
Classes="hover" | ||
Click="Close" | ||
ClickMode="Release" | ||
Data="{StaticResource CloseGeometry}" | ||
DockPanel.Dock="Right" | ||
Foreground="{DynamicResource MainTextColor}" | ||
IconHeight="10" | ||
IconWidth="10" | ||
Width="30" | ||
x:Name="CloseButton" /> | ||
|
||
<customControls:IconButton | ||
Background="{DynamicResource WindowButtonBackgroundColor}" | ||
BorderBrush="{DynamicResource MainBorderColor}" | ||
BorderThickness="1,0,1,0" | ||
Classes="hover" | ||
Click="Minimize" | ||
Data="{StaticResource MinimizeGeometry}" | ||
DockPanel.Dock="Right" | ||
Foreground="{DynamicResource MainTextColor}" | ||
IconHeight="12" | ||
IconWidth="12" | ||
Width="30" | ||
x:Name="MinimizeButton" /> | ||
|
||
<TextBlock | ||
Background="{DynamicResource WindowSecondaryBackgroundColor}" | ||
Classes="txt" | ||
Foreground="{DynamicResource MainTextColor}" | ||
Height="28" | ||
LineHeight="28" | ||
Padding="30,0,0,0" | ||
Text="{CompiledBinding Effects}" | ||
TextAlignment="Center" | ||
x:Name="TitleText" /> | ||
</DockPanel> | ||
|
||
<Rectangle | ||
Fill="{DynamicResource WindowBorderColor}" | ||
Height="1" | ||
x:Name="BorderRectangle" /> | ||
|
||
<views:EffectsView | ||
Background="{DynamicResource NoisyTexture}" | ||
Focusable="True" | ||
Margin="0" | ||
Padding="10,2,5,10" | ||
PointerPressed="MoveWindow" /> | ||
</StackPanel> | ||
</Border> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using Avalonia; | ||
using Avalonia.Controls; | ||
using Avalonia.Input; | ||
using Avalonia.Interactivity; | ||
using Avalonia.Media; | ||
using PicView.Core.Config; | ||
using PicView.Core.Localization; | ||
|
||
namespace PicView.Avalonia.Win32.Views; | ||
|
||
public partial class EffectsWindow : Window | ||
{ | ||
public EffectsWindow() | ||
{ | ||
InitializeComponent(); | ||
if (SettingsHelper.Settings.Theme.GlassTheme) | ||
{ | ||
IconBorder.Background = Brushes.Transparent; | ||
IconBorder.BorderThickness = new Thickness(0); | ||
MinimizeButton.Background = Brushes.Transparent; | ||
MinimizeButton.BorderThickness = new Thickness(0); | ||
CloseButton.Background = Brushes.Transparent; | ||
CloseButton.BorderThickness = new Thickness(0); | ||
BorderRectangle.Height = 0; | ||
TitleText.Background = Brushes.Transparent; | ||
|
||
if (!Application.Current.TryGetResource("SecondaryTextColor", | ||
Application.Current.RequestedThemeVariant, out var textColor)) | ||
{ | ||
return; | ||
} | ||
|
||
if (textColor is not Color color) | ||
{ | ||
return; | ||
} | ||
|
||
TitleText.Foreground = new SolidColorBrush(color); | ||
MinimizeButton.Foreground = new SolidColorBrush(color); | ||
CloseButton.Foreground = new SolidColorBrush(color); | ||
} | ||
else if (!SettingsHelper.Settings.Theme.Dark) | ||
{ | ||
ParentBorder.Background = new SolidColorBrush(Color.FromArgb(114,132, 132, 132)); | ||
} | ||
Loaded += delegate | ||
{ | ||
MinWidth = MaxWidth = Width; | ||
Title = $"{TranslationHelper.Translation.Effects} - PicView"; | ||
}; | ||
KeyDown += (_, e) => | ||
{ | ||
if (e.Key is Key.Escape) | ||
{ | ||
Close(); | ||
} | ||
}; | ||
} | ||
|
||
private void MoveWindow(object? sender, PointerPressedEventArgs e) | ||
{ | ||
if (VisualRoot is null) { return; } | ||
|
||
var hostWindow = (Window)VisualRoot; | ||
hostWindow?.BeginMoveDrag(e); | ||
} | ||
|
||
private void Close(object? sender, RoutedEventArgs e) | ||
{ | ||
Close(); | ||
} | ||
|
||
private void Minimize(object? sender, RoutedEventArgs e) | ||
{ | ||
WindowState = WindowState.Minimized; | ||
} | ||
} |
Oops, something went wrong.