Skip to content

Commit

Permalink
release: 1.5.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
0x7c13 committed Jan 7, 2024
1 parent f099d45 commit b41084c
Show file tree
Hide file tree
Showing 112 changed files with 1,042 additions and 546 deletions.
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020-2024 Jackie (Jiaqi) Liu
Copyright (c) 2019-2024 Jackie (Jiaqi) Liu

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ TL;DR: You might notice that I work for Microsoft but Notepads is my personal pr
* Localization Contributors:
* [fr-FR][French (France)]: [François Rousselet](https://github.com/frousselet), [François-Joseph du Fou](https://github.com/FJduFou), [Armand Delessert](https://github.com/ArmandDelessert)
* [es-ES][Spanish (Spain)]: [Jose Pinilla](https://github.com/joseppinilla)
* [zh-CN][Chinese (S)]: [lindexi](https://github.com/lindexi), [walterlv](https://github.com/walterlv), [Jackie Liu](https://github.com/0x7c13)
* [zh-CN][Chinese (S)]: [lindexi](https://github.com/lindexi), [walterlv](https://github.com/walterlv), [0x7c13](https://github.com/0x7c13)
* [hu-HU][Hungarian (Hungary)]: [Csányi István](https://github.com/AmionSky), [Kristóf Kékesi](https://github.com/KristofKekesi)
* [tr-TR][Turkish (Turkey)]: [Mert Can Demir](https://github.com/validatedev), [Emirhakan Tanhan](https://github.com/EmirhakanTanhan)
* [ja-JP][Japanese (Japan)]: [Mamoru Satoh](https://github.com/pnp0a03)
Expand Down
2 changes: 1 addition & 1 deletion src/Notepads.Controls/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Notepads.Controls")]
[assembly: AssemblyCopyright("Copyright © 2020-2024 Jackie (Jiaqi) Liu")]
[assembly: AssemblyCopyright("Copyright © 2019-2024 Jackie (Jiaqi) Liu")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads
{
using System;
using System.Collections.Generic;
Expand Down
88 changes: 46 additions & 42 deletions src/Notepads/Brushes/HostBackdropAcrylicBrush.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Brushes
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Brushes
{
using System;
using System.Collections.Generic;
Expand All @@ -21,12 +26,12 @@
using Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas.Effects;
using Microsoft.Graphics.Canvas.UI.Composition;
using Notepads.Controls.Helpers;
using Controls.Helpers;

public sealed class HostBackdropAcrylicBrush : XamlCompositionBrushBase, IDisposable
{
public static readonly DependencyProperty TintOpacityProperty = DependencyProperty.Register(
"TintOpacity",
private static readonly DependencyProperty TintOpacityProperty = DependencyProperty.Register(
nameof(TintOpacity),
typeof(float),
typeof(HostBackdropAcrylicBrush),
new PropertyMetadata(0.0f, OnTintOpacityChanged)
Expand All @@ -38,29 +43,29 @@ public float TintOpacity
set => SetValue(TintOpacityProperty, value);
}

private static void OnTintOpacityChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
private static void OnTintOpacityChanged(DependencyObject dependencyObject,
DependencyPropertyChangedEventArgs args)
{
if (d is HostBackdropAcrylicBrush brush)
if (!(dependencyObject is HostBackdropAcrylicBrush brush)) return;

if (brush.CompositionBrush is CompositionEffectBrush)
{
if (brush.CompositionBrush is CompositionEffectBrush)
{
TintOpacityToArithmeticCompositeEffectSourceAmount((float)e.NewValue,
_acrylicTintOpacityMinThreshold,
out var source1Amount,
out var source2Amount);
brush.CompositionBrush?.Properties.InsertScalar("LuminosityBlender.Source1Amount", source1Amount);
brush.CompositionBrush?.Properties.InsertScalar("LuminosityBlender.Source2Amount", source2Amount);
}
else if (brush.CompositionBrush is CompositionColorBrush)
{
// Do nothing since we are falling back to CompositionColorBrush here
// TintOpacity only applies to the CompositionEffectBrush we created
}
TintOpacityToArithmeticCompositeEffectSourceAmount((float)args.NewValue,
_acrylicTintOpacityMinThreshold,
out var source1Amount,
out var source2Amount);
brush.CompositionBrush?.Properties.InsertScalar("LuminosityBlender.Source1Amount", source1Amount);
brush.CompositionBrush?.Properties.InsertScalar("LuminosityBlender.Source2Amount", source2Amount);
}
else if (brush.CompositionBrush is CompositionColorBrush)
{
// Do nothing since we are falling back to CompositionColorBrush here
// TintOpacity only applies to the CompositionEffectBrush we created
}
}

public static readonly DependencyProperty LuminosityColorProperty = DependencyProperty.Register(
"LuminosityColor",
private static readonly DependencyProperty LuminosityColorProperty = DependencyProperty.Register(
nameof(LuminosityColor),
typeof(Color),
typeof(HostBackdropAcrylicBrush),
new PropertyMetadata(Colors.Transparent, OnLuminosityColorChanged)
Expand All @@ -72,30 +77,31 @@ public Color LuminosityColor
set => SetValue(LuminosityColorProperty, value);
}

private static void OnLuminosityColorChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
private static void OnLuminosityColorChanged(DependencyObject dependencyObject,
DependencyPropertyChangedEventArgs args)
{
if (d is HostBackdropAcrylicBrush brush)
if (!(dependencyObject is HostBackdropAcrylicBrush brush)) return;

switch (brush.CompositionBrush)
{
if (brush.CompositionBrush is CompositionEffectBrush)
{
if (brush.CompositionBrush?.Properties.TryGetColor("LuminosityColor.Color", out var currentColor) == CompositionGetValueStatus.Succeeded)
case CompositionEffectBrush _
when brush.CompositionBrush?.Properties.TryGetColor("LuminosityColor.Color", out var currentColor)
== CompositionGetValueStatus.Succeeded:
{
var easing = Window.Current.Compositor.CreateLinearEasingFunction();
var animation = Window.Current.Compositor.CreateColorKeyFrameAnimation();
animation.InsertKeyFrame(0.0f, currentColor);
animation.InsertKeyFrame(1.0f, (Color)e.NewValue, easing);
animation.InsertKeyFrame(1.0f, (Color)args.NewValue, easing);
animation.Duration = TimeSpan.FromMilliseconds(167);
brush.CompositionBrush.StartAnimation("LuminosityColor.Color", animation);
break;
}
else
{
brush.CompositionBrush?.Properties.InsertColor("LuminosityColor.Color", (Color)e.NewValue);
}
}
else if (brush.CompositionBrush is CompositionColorBrush colorBrush)
{
colorBrush.Color = (Color)e.NewValue;
}
case CompositionEffectBrush _:
brush.CompositionBrush?.Properties.InsertColor("LuminosityColor.Color", (Color)args.NewValue);
break;
case CompositionColorBrush colorBrush:
colorBrush.Color = (Color)args.NewValue;
break;
}
}

Expand Down Expand Up @@ -136,7 +142,7 @@ private async Task BuildInternalAsync()
}
else
{
CompositionBrush = await BuildHostBackdropAcrylicBrushAsync();
CompositionBrush = await BuildHostBackdropAcrylicBrushInternalAsync();
}

// Register energy saver event
Expand All @@ -147,12 +153,10 @@ private async Task BuildInternalAsync()
UISettings.AdvancedEffectsEnabledChanged -= OnAdvancedEffectsEnabledChanged;
UISettings.AdvancedEffectsEnabledChanged += OnAdvancedEffectsEnabledChanged;
}
catch (Exception ex)
catch (Exception)
{
// Fallback to color brush if unable to create HostBackdropAcrylicBrush
CompositionBrush = Window.Current.Compositor.CreateColorBrush(LuminosityColor);
Analytics.TrackEvent("FailedToBuildAcrylicBrush",
new Dictionary<string, string> { { "Exception", ex.ToString() } });
}
finally
{
Expand Down Expand Up @@ -191,7 +195,7 @@ protected override async void OnDisconnected()
base.OnDisconnected();
}

public async Task<CompositionBrush> BuildHostBackdropAcrylicBrushAsync()
private async Task<CompositionBrush> BuildHostBackdropAcrylicBrushInternalAsync()
{
int stage = 0;

Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Commands/CommandHandlerResult.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Commands
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Commands
{
public class CommandHandlerResult
{
Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Commands/ICommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Commands
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Commands
{
public interface ICommandHandler<in T>
{
Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Commands/IKeyboardCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Commands
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Commands
{
using Windows.System;

Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Commands/IMouseCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Commands
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Commands
{
public interface IMouseCommand<in T>
{
Expand Down
9 changes: 7 additions & 2 deletions src/Notepads/Commands/KeyboardCommand.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
namespace Notepads.Commands
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Commands
{
using System;
using System.Collections.Generic;
using Windows.System;

public class KeyboardCommand<T> : IKeyboardCommand<T>
public sealed class KeyboardCommand<T> : IKeyboardCommand<T>
{
private static readonly TimeSpan ConsecutiveHitsInterval = TimeSpan.FromMilliseconds(500);

Expand Down
9 changes: 7 additions & 2 deletions src/Notepads/Commands/KeyboardCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
namespace Notepads.Commands
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Commands
{
using System.Collections.Generic;
using Windows.System;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Input;

public class KeyboardCommandHandler : ICommandHandler<KeyRoutedEventArgs>
public sealed class KeyboardCommandHandler : ICommandHandler<KeyRoutedEventArgs>
{
public readonly ICollection<IKeyboardCommand<KeyRoutedEventArgs>> Commands;

Expand Down
9 changes: 7 additions & 2 deletions src/Notepads/Commands/MouseCommand.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
namespace Notepads.Commands
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Commands
{
using System;

public class MouseCommand<T> : IMouseCommand<T>
public sealed class MouseCommand<T> : IMouseCommand<T>
{
private readonly bool _ctrl;
private readonly bool _alt;
Expand Down
9 changes: 7 additions & 2 deletions src/Notepads/Commands/MouseCommandHandler.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
namespace Notepads.Commands
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Commands
{
using System.Collections.Generic;
using Windows.System;
using Windows.UI.Core;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Input;

public class MouseCommandHandler : ICommandHandler<PointerRoutedEventArgs>
public sealed class MouseCommandHandler : ICommandHandler<PointerRoutedEventArgs>
{
public readonly ICollection<IMouseCommand<PointerRoutedEventArgs>> Commands;

Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Controls/Dialog/AppCloseSaveReminderDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Controls.Dialog
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Controls.Dialog
{
using System;
using Windows.UI;
Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Controls/Dialog/FileOpenErrorDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Controls.Dialog
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Controls.Dialog
{
public sealed class FileOpenErrorDialog : NotepadsDialog
{
Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Controls/Dialog/FileRenameDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Controls.Dialog
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Controls.Dialog
{
using System;
using System.Collections.Generic;
Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Controls/Dialog/FileSaveErrorDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Controls.Dialog
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Controls.Dialog
{
public sealed class FileSaveErrorDialog : NotepadsDialog
{
Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Controls/Dialog/NotepadsDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Controls.Dialog
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Controls.Dialog
{
using Windows.ApplicationModel.Resources;
using Windows.UI;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Controls.Dialog
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Controls.Dialog
{
using System;

Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Controls/Dialog/SessionCorruptionErrorDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Controls.Dialog
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Controls.Dialog
{
using System;
using Windows.UI;
Expand Down
7 changes: 6 additions & 1 deletion src/Notepads/Controls/Dialog/SetCloseSaveReminderDialog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
namespace Notepads.Controls.Dialog
// ---------------------------------------------------------------------------------------------
// Copyright (c) 2019-2024, Jiaqi (0x7c13) Liu. All rights reserved.
// See LICENSE file in the project root for license information.
// ---------------------------------------------------------------------------------------------

namespace Notepads.Controls.Dialog
{
using System;

Expand Down
Loading

0 comments on commit b41084c

Please sign in to comment.