CI / Build and test (push) Successful in 8m19s
CI / Windows tests and installer (push) Skipped
CI / YAML check (push) Successful in 7s
Release / Build, test and publish (push) Successful in 12m9s
CI / PostgreSQL 16 integration (push) Successful in 7m49s
CI / PostgreSQL 17 integration (push) Successful in 7m19s
CI / Docker image (push) Successful in 46s
Release / Server image (push) Successful in 1m14s
Owner review 1 R5 + R6. Camera rotation, mirror, flip, straighten and crop handles locked to the output; an Exposure Look group; Export output size ("proportions win"); settings format 2 with older-node gates. Also fixes project text and hashes differing between Windows and Linux.
Closes #19
Closes #20
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Alberto Balbo <alberto.balbo.96@gmail.com>
51 lines
2.5 KiB
C#
51 lines
2.5 KiB
C#
using System.Windows;
|
|
|
|
namespace Chronos.App.Editor;
|
|
|
|
/// <summary>
|
|
/// Whether the user is using a control (it holds the keyboard focus or the mouse capture: a slider dragged or focused),
|
|
/// for a binding to say so (<see cref="IsActiveProperty"/>, bound one way to the source): the Camera step's Straighten
|
|
/// shows the preview's grid while it is used (owner review 1, R6). <see cref="TracksProperty"/> starts the tracking.
|
|
/// </summary>
|
|
public static class SliderActivity
|
|
{
|
|
public static readonly DependencyProperty TracksProperty = DependencyProperty.RegisterAttached(
|
|
"Tracks", typeof(bool), typeof(SliderActivity), new PropertyMetadata(false, OnTracksChanged));
|
|
|
|
public static readonly DependencyProperty IsActiveProperty = DependencyProperty.RegisterAttached(
|
|
"IsActive", typeof(bool), typeof(SliderActivity), new FrameworkPropertyMetadata(false));
|
|
|
|
public static bool GetTracks(DependencyObject d) => (bool)d.GetValue(TracksProperty);
|
|
|
|
public static void SetTracks(DependencyObject d, bool value) => d.SetValue(TracksProperty, value);
|
|
|
|
public static bool GetIsActive(DependencyObject d) => (bool)d.GetValue(IsActiveProperty);
|
|
|
|
public static void SetIsActive(DependencyObject d, bool value) => d.SetValue(IsActiveProperty, value);
|
|
|
|
private static void OnTracksChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
|
{
|
|
if (d is not FrameworkElement element) return;
|
|
element.IsKeyboardFocusWithinChanged -= OnChanged;
|
|
element.IsMouseCaptureWithinChanged -= OnChanged;
|
|
element.Unloaded -= OnUnloaded;
|
|
if (e.NewValue is not true) return;
|
|
element.IsKeyboardFocusWithinChanged += OnChanged;
|
|
element.IsMouseCaptureWithinChanged += OnChanged;
|
|
element.Unloaded += OnUnloaded;
|
|
Update(element);
|
|
}
|
|
|
|
private static void OnChanged(object sender, DependencyPropertyChangedEventArgs e) => Update((FrameworkElement)sender);
|
|
|
|
/// <summary>A control taken off screen (another step) is no longer being used.</summary>
|
|
private static void OnUnloaded(object sender, RoutedEventArgs e) => ((FrameworkElement)sender).SetCurrentValue(IsActiveProperty, false);
|
|
|
|
/// <summary>Set through <see cref="DependencyObject.SetCurrentValue"/>, so a binding on the property stays and receives it.</summary>
|
|
private static void Update(FrameworkElement element)
|
|
{
|
|
var active = element.IsKeyboardFocusWithin || element.IsMouseCaptureWithin;
|
|
if (GetIsActive(element) != active) element.SetCurrentValue(IsActiveProperty, active);
|
|
}
|
|
}
|